arsa  2.7
arsa_hash.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2003-2022, Troy D. Hanson https://troydhanson.github.io/uthash/
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright
9  notice, this list of conditions and the following disclaimer.
10 
11 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
12 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
13 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
15 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 */
23 
24 #ifndef __ARSA_HASH_H__
25 #define __ARSA_HASH_H__
26 
27 #include <arsa_begin_code.h>
28 #include <irrlicht.h>
29 
31 struct SHash;
32 
34 extern ARSA_API SHash* ARSACALLCONV hash_create();
36 extern ARSA_API void ARSACALLCONV hash_free(SHash** hash);
38 extern ARSA_API SHash* ARSACALLCONV hash_push_back(SHash* hash, const irr::core::stringc& name, void* userdata);
40 extern ARSA_API SHash* ARSACALLCONV hash_get(SHash* hash, const irr::core::stringc& name);
42 extern ARSA_API void* ARSACALLCONV hash_get_userdata(SHash* hash, const irr::core::stringc& name);
44 extern ARSA_API void* ARSACALLCONV hash_get_userdata(SHash* hash);
46 extern ARSA_API const char* ARSACALLCONV hash_get_name(SHash* hash);
48 extern ARSA_API void ARSACALLCONV hash_erase(SHash** hash, SHash* dead);
50 extern ARSA_API void ARSACALLCONV hash_erase(SHash** hash, const irr::core::stringc& name);
52 extern ARSA_API SHash* ARSACALLCONV hash_next(SHash* hash);
55 extern ARSA_API void ARSACALLCONV hash_sort(SHash* hash, int(*compar)(const void*, const void*));
57 extern ARSA_API void ARSACALLCONV hash_clear(SHash* hash, void(*clear)(const void*) = 0);
59 extern ARSA_API irr::u32 ARSACALLCONV hash_size(SHash* hash);
60 
61 #endif // !__ARSA_HASH_H__
ARSA_API void ARSACALLCONV hash_free(SHash **hash)
free all hash table, except user data
ARSA_API void *ARSACALLCONV hash_get_userdata(SHash *hash, const irr::core::stringc &name)
get userdata in hash table by name
GLuint const GLchar * name
Main header file of the irrlicht, the only file needed to include.
Very simple string class with some useful features.
Definition: irrString.h:37
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
ARSA_API SHash *ARSACALLCONV hash_next(SHash *hash)
next element in hash table
ARSA_API irr::u32 ARSACALLCONV hash_size(SHash *hash)
elements count in hash table
ARSA_API SHash *ARSACALLCONV hash_get(SHash *hash, const irr::core::stringc &name)
get data in hash table by name
ARSA_API SHash *ARSACALLCONV hash_push_back(SHash *hash, const irr::core::stringc &name, void *userdata)
add new element to hash table
#define ARSA_API
ARSA_API SHash *ARSACALLCONV hash_create()
create first hash table
ARSA_API void ARSACALLCONV hash_clear(SHash *hash, void(*clear)(const void *)=0)
clear all elements in hash table
ARSA_API const char *ARSACALLCONV hash_get_name(SHash *hash)
get name in currently hash
ARSA_API void ARSACALLCONV hash_erase(SHash **hash, SHash *dead)
del data in hash table
#define ARSACALLCONV
ARSA_API void ARSACALLCONV hash_sort(SHash *hash, int(*compar)(const void *, const void *))