1 | /* -*- Mode: c; c-basic-offset: 2 -*- |
2 | * |
3 | * rdf_hash.h - RDF Hash Factory and Hash interfaces and definitions |
4 | * |
5 | * Copyright (C) 2000-2008, David Beckett http://www.dajobe.org/ |
6 | * Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac.uk/ |
7 | * |
8 | * This package is Free Software and part of Redland http://librdf.org/ |
9 | * |
10 | * It is licensed under the following three licenses as alternatives: |
11 | * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version |
12 | * 2. GNU General Public License (GPL) V2 or any newer version |
13 | * 3. Apache License, V2.0 or any newer version |
14 | * |
15 | * You may not use this file except in compliance with at least one of |
16 | * the above three licenses. |
17 | * |
18 | * See LICENSE.html or LICENSE.txt at the top of this package for the |
19 | * complete terms and further detail along with the license texts for |
20 | * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. |
21 | * |
22 | * |
23 | */ |
24 | |
25 | |
26 | #ifndef LIBRDF_HASH_H |
27 | #define LIBRDF_HASH_H |
28 | |
29 | #ifdef LIBRDF_INTERNAL |
30 | #include <rdf_hash_internal.h> |
31 | #endif |
32 | |
33 | #ifdef __cplusplus |
34 | extern "C" { |
35 | #endif |
36 | |
37 | /* public constructors */ |
38 | REDLAND_API |
39 | librdf_hash* librdf_new_hash(librdf_world *world, const char *name); |
40 | REDLAND_API |
41 | librdf_hash* librdf_new_hash_from_string(librdf_world *world, const char *name, const char *string); |
42 | REDLAND_API |
43 | librdf_hash* librdf_new_hash_from_array_of_strings(librdf_world *world, const char *name, const char **array); |
44 | |
45 | /* public copy constructor */ |
46 | REDLAND_API |
47 | librdf_hash* librdf_new_hash_from_hash (librdf_hash* old_hash); |
48 | |
49 | /* public destructor */ |
50 | REDLAND_API |
51 | void librdf_free_hash(librdf_hash *hash); |
52 | |
53 | /* public methods */ |
54 | |
55 | /* retrieve one value for a given hash key */ |
56 | REDLAND_API |
57 | char* librdf_hash_get(librdf_hash* hash, const char *key); |
58 | |
59 | /* lookup a hash key and decode value as a boolean */ |
60 | REDLAND_API |
61 | int librdf_hash_get_as_boolean(librdf_hash* hash, const char *key); |
62 | |
63 | /* lookup a hash key and decode value as a long */ |
64 | REDLAND_API |
65 | long librdf_hash_get_as_long(librdf_hash* hash, const char *key); |
66 | |
67 | /* retrieve one value for key and delete from hash all other values */ |
68 | REDLAND_API |
69 | char* librdf_hash_get_del(librdf_hash* hash, const char *key); |
70 | |
71 | /* insert a key/value pair */ |
72 | REDLAND_API |
73 | int librdf_hash_put_strings(librdf_hash* hash, const char *key, const char *value); |
74 | |
75 | /* make a hash from a string */ |
76 | REDLAND_API |
77 | int librdf_hash_from_string(librdf_hash* hash, const char *string); |
78 | |
79 | /* make a string from a hash */ |
80 | REDLAND_API |
81 | char* librdf_hash_to_string(librdf_hash* hash, const char *filter[]); |
82 | |
83 | REDLAND_API |
84 | void librdf_hash_print(librdf_hash* hash, FILE *fh); |
85 | REDLAND_API |
86 | void librdf_hash_print_keys(librdf_hash* hash, FILE *fh); |
87 | REDLAND_API |
88 | void librdf_hash_print_values(librdf_hash* hash, const char *key_string, FILE *fh); |
89 | |
90 | REDLAND_API |
91 | unsigned char* librdf_hash_interpret_template(const unsigned char* template_string, librdf_hash* dictionary, const unsigned char* prefix, const unsigned char* suffix); |
92 | |
93 | #ifdef __cplusplus |
94 | } |
95 | #endif |
96 | |
97 | #endif |
98 | |