patch-docs_man3_qbmap_h_3 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. --- libqb-0.16.0.orig/docs/man3/qbmap.h.3 2013-07-25 20:16:18.000000000 +0200
  2. +++ libqb-0.16.0/docs/man3/qbmap.h.3 2013-09-09 05:26:31.803806391 +0200
  3. @@ -1,4 +1,4 @@
  4. -.TH "qbmap.h" 3 "Thu Jul 25 2013" "Version 0.16.0" "libqb" \" -*- nroff -*-
  5. +.TH "qbmap.h" 3 "Mon Sep 9 2013" "Version 0.16.0" "libqb" \" -*- nroff -*-
  6. .ad l
  7. .nh
  8. .SH NAME
  9. @@ -14,7 +14,7 @@ This provides a map interface to a Patri
  10. \fC#include <unistd\&.h>\fP
  11. .br
  12. -.SS "Macros"
  13. +.SS "Defines"
  14. .in +1c
  15. .ti -1c
  16. @@ -137,13 +137,13 @@ The hashtable is NOT ordered, but ptrie
  17. Below is a simple example of how to iterate over a map\&.
  18. .PP
  19. .nf
  20. -const char *p;
  21. -void *data;
  22. -qb_map_iter_t *it = qb_map_iter_create(m);
  23. -for (p = qb_map_iter_next(it, &data); p; p = qb_map_iter_next(it, &data)) {
  24. - printf('%s > %s\n', p, (char*) data);
  25. -}
  26. -qb_map_iter_free(it);
  27. + const char *p;
  28. + void *data;
  29. + qb_map_iter_t *it = qb_map_iter_create(m);
  30. + for (p = qb_map_iter_next(it, &data); p; p = qb_map_iter_next(it, &data)) {
  31. + printf('%s > %s\n', p, (char*) data);
  32. + }
  33. + qb_map_iter_free(it);
  34. .fi
  35. .PP
  36. @@ -152,8 +152,8 @@ qb_map_iter_free(it);
  37. Deletion of items within the iterator is supported\&. But note do not free the item memory in the iterator\&. If you need to free the data items then register for a notifier and free the memory there\&. This is required as the items are reference counted\&.
  38. .PP
  39. .nf
  40. -qb_map_notify_add(m, NULL, my_map_free_handler,
  41. - QB_MAP_NOTIFY_FREE, NULL);
  42. + qb_map_notify_add(m, NULL, my_map_free_handler,
  43. + QB_MAP_NOTIFY_FREE, NULL);
  44. .fi
  45. .PP
  46. @@ -168,7 +168,7 @@ These allow you to get callbacks when va
  47. hashtable only supports deletion and replacement notificatins\&. There is also a special global callback for freeing deleted and replaced values (QB_MAP_NOTIFY_FREE)\&.
  48. .RE
  49. .PP
  50. -\fBSee Also:\fP
  51. +\fBSee also:\fP
  52. .RS 4
  53. \fBqb_map_notify_add()\fP \fBqb_map_notify_del_2()\fP
  54. .RE
  55. @@ -180,57 +180,47 @@ The ptrie supports prefixes in the itera
  56. .PP
  57. .PP
  58. .nf
  59. -it = qb_map_pref_iter_create(m, 'aa');
  60. -while ((p = qb_map_iter_next(it, &data)) != NULL) {
  61. - printf('%s > %s\n', p, (char*)data);
  62. -}
  63. -qb_map_iter_free(it);
  64. + it = qb_map_pref_iter_create(m, 'aa');
  65. + while ((p = qb_map_iter_next(it, &data)) != NULL) {
  66. + printf('%s > %s\n', p, (char*)data);
  67. + }
  68. + qb_map_iter_free(it);
  69. .fi
  70. .PP
  71. .PP
  72. The ptrie also supports prefixes in notifications: (remember to pass QB_MAP_NOTIFY_RECURSIVE into the notify_add\&.
  73. .PP
  74. .nf
  75. -qb_map_notify_add(m, 'root', my_map_notification,
  76. - (QB_MAP_NOTIFY_INSERTED|
  77. - QB_MAP_NOTIFY_DELETED|
  78. - QB_MAP_NOTIFY_REPLACED|
  79. - QB_MAP_NOTIFY_RECURSIVE),
  80. - NULL);
  81. + qb_map_notify_add(m, 'root', my_map_notification,
  82. + (QB_MAP_NOTIFY_INSERTED|
  83. + QB_MAP_NOTIFY_DELETED|
  84. + QB_MAP_NOTIFY_REPLACED|
  85. + QB_MAP_NOTIFY_RECURSIVE),
  86. + NULL);
  87. .fi
  88. .PP
  89. -.SH "Macro Definition Documentation"
  90. +.SH "Define Documentation"
  91. .PP
  92. -.SS "#define QB_MAP_NOTIFY_DELETED 1"
  93. -
  94. -.SS "#define QB_MAP_NOTIFY_FREE 16"
  95. -
  96. -.SS "#define QB_MAP_NOTIFY_INSERTED 4"
  97. -
  98. -.SS "#define QB_MAP_NOTIFY_RECURSIVE 8"
  99. -
  100. -.SS "#define QB_MAP_NOTIFY_REPLACED 2"
  101. -
  102. +.SS "#define \fBQB_MAP_NOTIFY_DELETED\fP 1"
  103. +.SS "#define \fBQB_MAP_NOTIFY_FREE\fP 16"
  104. +.SS "#define \fBQB_MAP_NOTIFY_INSERTED\fP 4"
  105. +.SS "#define \fBQB_MAP_NOTIFY_RECURSIVE\fP 8"
  106. +.SS "#define \fBQB_MAP_NOTIFY_REPLACED\fP 2"
  107. .SH "Typedef Documentation"
  108. .PP
  109. .SS "typedef struct qb_map_iter \fBqb_map_iter_t\fP"
  110. -
  111. .PP
  112. This is an opaque data type representing an iterator instance\&.
  113. -.SS "typedef void(* qb_map_notify_fn)(uint32_t event, char *key, void *old_value, void *value, void *user_data)"
  114. -
  115. +.SS "typedef void(* \fBqb_map_notify_fn\fP)(uint32_t event, char *key, void *old_value, void *value, void *user_data)"
  116. .SS "typedef struct qb_map \fBqb_map_t\fP"
  117. -
  118. .PP
  119. This is an opaque data type representing an instance of a map\&.
  120. -.SS "typedef int32_t(* qb_map_transverse_fn)(const char *key, void *value, void *user_data)"
  121. -
  122. +.SS "typedef int32_t(* \fBqb_map_transverse_fn\fP)(const char *key, void *value, void *user_data)"
  123. .SH "Function Documentation"
  124. .PP
  125. -.SS "\fBqb_map_t\fP* qb_hashtable_create (size_tmax_size)"
  126. -
  127. +.SS "\fBqb_map_t\fP* \fBqb_hashtable_create\fP (size_tmax_size)"
  128. .PP
  129. Create an unsorted map based on a hashtable\&. \fBParameters:\fP
  130. .RS 4
  131. @@ -243,20 +233,16 @@ the map instance
  132. .RE
  133. .PP
  134. -.SS "size_t qb_map_count_get (\fBqb_map_t\fP *map)"
  135. -
  136. +.SS "size_t \fBqb_map_count_get\fP (\fBqb_map_t\fP *map)"
  137. .PP
  138. Get the number of items in the map\&.
  139. -.SS "void qb_map_destroy (\fBqb_map_t\fP *map)"
  140. -
  141. +.SS "void \fBqb_map_destroy\fP (\fBqb_map_t\fP *map)"
  142. .PP
  143. Destroy the map, removes all the items from the map\&.
  144. -.SS "void qb_map_foreach (\fBqb_map_t\fP *map, \fBqb_map_transverse_fn\fPfunc, void *user_data)"
  145. -
  146. +.SS "void \fBqb_map_foreach\fP (\fBqb_map_t\fP *map, \fBqb_map_transverse_fn\fPfunc, void *user_data)"
  147. .PP
  148. Calls the given function for each of the key/value pairs in the map\&. The function is passed the key and value of each pair, and the given data parameter\&. The map is traversed in sorted order\&.
  149. -.SS "void* qb_map_get (\fBqb_map_t\fP *map, const char *key)"
  150. -
  151. +.SS "void* \fBqb_map_get\fP (\fBqb_map_t\fP *map, const char *key)"
  152. .PP
  153. Gets the value corresponding to the given key\&. \fBReturn values:\fP
  154. .RS 4
  155. @@ -266,12 +252,10 @@ Gets the value corresponding to the give
  156. .RE
  157. .PP
  158. -.SS "\fBqb_map_iter_t\fP* qb_map_iter_create (\fBqb_map_t\fP *map)"
  159. -
  160. +.SS "\fBqb_map_iter_t\fP* \fBqb_map_iter_create\fP (\fBqb_map_t\fP *map)"
  161. .PP
  162. Create an iterator\&.
  163. -.SS "void qb_map_iter_free (\fBqb_map_iter_t\fP *i)"
  164. -
  165. +.SS "void \fBqb_map_iter_free\fP (\fBqb_map_iter_t\fP *i)"
  166. .PP
  167. free the iterator \fBParameters:\fP
  168. .RS 4
  169. @@ -279,8 +263,7 @@ free the iterator \fBParameters:\fP
  170. .RE
  171. .PP
  172. -.SS "const char* qb_map_iter_next (\fBqb_map_iter_t\fP *i, void **value)"
  173. -
  174. +.SS "const char* \fBqb_map_iter_next\fP (\fBqb_map_iter_t\fP *i, void **value)"
  175. .PP
  176. Get the next item\&. \fBParameters:\fP
  177. .RS 4
  178. @@ -297,8 +280,7 @@ Get the next item\&. \fBParameters:\fP
  179. .RE
  180. .PP
  181. -.SS "int32_t qb_map_notify_add (\fBqb_map_t\fP *m, const char *key, \fBqb_map_notify_fn\fPfn, int32_tevents, void *user_data)"
  182. -
  183. +.SS "int32_t \fBqb_map_notify_add\fP (\fBqb_map_t\fP *m, const char *key, \fBqb_map_notify_fn\fPfn, int32_tevents, void *user_data)"
  184. .PP
  185. Add a notifier to the map\&. \fBParameters:\fP
  186. .RS 4
  187. @@ -328,8 +310,7 @@ you can use key prefixes with trie maps\
  188. .RE
  189. .PP
  190. -.SS "int32_t qb_map_notify_del (\fBqb_map_t\fP *m, const char *key, \fBqb_map_notify_fn\fPfn, int32_tevents)"
  191. -
  192. +.SS "int32_t \fBqb_map_notify_del\fP (\fBqb_map_t\fP *m, const char *key, \fBqb_map_notify_fn\fPfn, int32_tevents)"
  193. .PP
  194. Delete a notifier from the map\&. \fBNote:\fP
  195. .RS 4
  196. @@ -355,8 +336,7 @@ the key,fn and events must match those y
  197. .RE
  198. .PP
  199. -.SS "int32_t qb_map_notify_del_2 (\fBqb_map_t\fP *m, const char *key, \fBqb_map_notify_fn\fPfn, int32_tevents, void *user_data)"
  200. -
  201. +.SS "int32_t \fBqb_map_notify_del_2\fP (\fBqb_map_t\fP *m, const char *key, \fBqb_map_notify_fn\fPfn, int32_tevents, void *user_data)"
  202. .PP
  203. Delete a notifier from the map (including the userdata)\&. \fBNote:\fP
  204. .RS 4
  205. @@ -384,8 +364,7 @@ the key, fn, events and userdata must ma
  206. .RE
  207. .PP
  208. -.SS "\fBqb_map_iter_t\fP* qb_map_pref_iter_create (\fBqb_map_t\fP *map, const char *prefix)"
  209. -
  210. +.SS "\fBqb_map_iter_t\fP* \fBqb_map_pref_iter_create\fP (\fBqb_map_t\fP *map, const char *prefix)"
  211. .PP
  212. Create a prefix iterator\&. This will iterate over all items with the given prefix\&.
  213. .PP
  214. @@ -395,16 +374,13 @@ this is only supported by the trie\&.
  215. .RE
  216. .PP
  217. -.SS "void qb_map_put (\fBqb_map_t\fP *map, const char *key, const void *value)"
  218. -
  219. +.SS "void \fBqb_map_put\fP (\fBqb_map_t\fP *map, const char *key, const void *value)"
  220. .PP
  221. Inserts a new key and value into a qb_map_t\&. If the key already exists in the qb_map_t, it gets replaced by the new key\&.
  222. -.SS "int32_t qb_map_rm (\fBqb_map_t\fP *map, const char *key)"
  223. -
  224. +.SS "int32_t \fBqb_map_rm\fP (\fBqb_map_t\fP *map, const char *key)"
  225. .PP
  226. Removes a key/value pair from a map\&.
  227. -.SS "\fBqb_map_t\fP* qb_skiplist_create (void)"
  228. -
  229. +.SS "\fBqb_map_t\fP* \fBqb_skiplist_create\fP (void)"
  230. .PP
  231. Create a sorted map using a skiplist\&. \fBReturns:\fP
  232. .RS 4
  233. @@ -412,12 +388,10 @@ the map instance
  234. .RE
  235. .PP
  236. -.SS "\fBqb_map_t\fP* qb_trie_create (void)"
  237. -
  238. +.SS "\fBqb_map_t\fP* \fBqb_trie_create\fP (void)"
  239. .PP
  240. Create a sorted map using a Patricia trie or 'Radix tree'\&.
  241. -.SS "void qb_trie_dump (\fBqb_map_t\fP *m)"
  242. -
  243. +.SS "void \fBqb_trie_dump\fP (\fBqb_map_t\fP *m)"
  244. .PP
  245. print out the nodes in the trie (for debug purposes)
  246. .SH "Author"