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
34extern "C" {
35#endif
36
37/* public constructors */
38REDLAND_API
39librdf_hash* librdf_new_hash(librdf_world *world, const char *name);
40REDLAND_API
41librdf_hash* librdf_new_hash_from_string(librdf_world *world, const char *name, const char *string);
42REDLAND_API
43librdf_hash* librdf_new_hash_from_array_of_strings(librdf_world *world, const char *name, const char **array);
44
45/* public copy constructor */
46REDLAND_API
47librdf_hash* librdf_new_hash_from_hash (librdf_hash* old_hash);
48
49/* public destructor */
50REDLAND_API
51void librdf_free_hash(librdf_hash *hash);
52
53/* public methods */
54
55/* retrieve one value for a given hash key */
56REDLAND_API
57char* librdf_hash_get(librdf_hash* hash, const char *key);
58
59/* lookup a hash key and decode value as a boolean */
60REDLAND_API
61int librdf_hash_get_as_boolean(librdf_hash* hash, const char *key);
62
63/* lookup a hash key and decode value as a long */
64REDLAND_API
65long 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 */
68REDLAND_API
69char* librdf_hash_get_del(librdf_hash* hash, const char *key);
70
71/* insert a key/value pair */
72REDLAND_API
73int librdf_hash_put_strings(librdf_hash* hash, const char *key, const char *value);
74
75/* make a hash from a string */
76REDLAND_API
77int librdf_hash_from_string(librdf_hash* hash, const char *string);
78
79/* make a string from a hash */
80REDLAND_API
81char* librdf_hash_to_string(librdf_hash* hash, const char *filter[]);
82
83REDLAND_API
84void librdf_hash_print(librdf_hash* hash, FILE *fh);
85REDLAND_API
86void librdf_hash_print_keys(librdf_hash* hash, FILE *fh);
87REDLAND_API
88void librdf_hash_print_values(librdf_hash* hash, const char *key_string, FILE *fh);
89
90REDLAND_API
91unsigned 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