天嵌二次封装库使用手册  V2.1.2
dictionary.h
浏览该文件的文档.
1 #ifndef _DICTIONARY_H_
2 #define _DICTIONARY_H_
3 
20 /*-------------------------------------------------------------------------*/
30 /*--------------------------------------------------------------------------*/
31 
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35 #include <unistd.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
46 typedef struct _dictionary_ {
47  int n ;
48  ssize_t size ;
49  char ** val ;
50  char ** key ;
51  unsigned * hash ;
52 } dictionary ;
53 
61 unsigned dictionary_hash(const char * key);
62 
71 
78 void dictionary_del(dictionary * vd);
79 
89 const char * dictionary_get(const dictionary * d, const char * key, const char * def);
90 
105 int dictionary_set(dictionary * vd, const char * key, const char * val);
106 
114 void dictionary_unset(dictionary * d, const char * key);
115 
123 void dictionary_dump(const dictionary * d, FILE * out);
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif
void dictionary_unset(dictionary *d, const char *key)
删除dictionary对象的一个key值
void dictionary_dump(const dictionary *d, FILE *out)
将dictionary对象转储到已打开的文件指针中
unsigned * hash
Definition: dictionary.h:51
void dictionary_del(dictionary *vd)
删除一个dictionary对象
const char * dictionary_get(const dictionary *d, const char *key, const char *def)
获取dictionary对象的key值
ssize_t size
Definition: dictionary.h:48
char ** key
Definition: dictionary.h:50
unsigned dictionary_hash(const char *key)
计算键的hash值
int dictionary_set(dictionary *vd, const char *key, const char *val)
设置dictionary对象的key值
char ** val
Definition: dictionary.h:49
dictionary对象结构体
Definition: dictionary.h:46
dictionary * dictionary_new(size_t size)
创建一个dictionary对象
struct _dictionary_ dictionary
dictionary对象结构体