![]() |
![]() |
![]() |
Redland RDF Library Manual | ![]() |
---|---|---|---|---|
typedef librdf_hash; typedef librdf_hash_cursor; librdf_hash* librdf_new_hash_from_string (librdf_world *world, const char *name, const char *string); librdf_hash* librdf_new_hash_from_array_of_strings (librdf_world *world, const char *name, const char **array); librdf_hash* librdf_new_hash_from_hash (librdf_hash *old_hash); void librdf_free_hash (librdf_hash *hash); char* librdf_hash_get (librdf_hash *hash, const char *key); int librdf_hash_get_as_boolean (librdf_hash *hash, const char *key); long librdf_hash_get_as_long (librdf_hash *hash, const char *key); char* librdf_hash_get_del (librdf_hash *hash, const char *key); int librdf_hash_put_strings (librdf_hash *hash, const char *key, const char *value); void librdf_hash_print (librdf_hash *hash, FILE *fh); void librdf_hash_print_keys (librdf_hash *hash, FILE *fh); void librdf_hash_print_values (librdf_hash *hash, const char *key_string, FILE *fh); unsigned char* librdf_hash_interpret_template (unsigned char *template_string, librdf_hash *dictionary, unsigned char *prefix, unsigned char *suffix);
Interface to implementations of key:value hashes either in memory, on disk and with persistence. Keys may have multiple and duplicate values.
typedef struct librdf_hash_cursor_s librdf_hash_cursor;
Redland hash cursor class.
librdf_hash* librdf_new_hash_from_string (librdf_world *world, const char *name, const char *string);
Constructor - create a new librdf_hash object from a string.
See librdf_hash_from_string for the string format.
|
redland world object |
|
hash name |
|
hash encoded as a string |
Returns : |
a new librdf_hash object or NULL on failure |
librdf_hash* librdf_new_hash_from_array_of_strings (librdf_world *world, const char *name, const char **array);
Constructor - create a new librdf_hash object from an array of strings.
|
redland world object |
|
hash name |
|
address of the start of the array of char* pointers |
Returns : |
a new librdf_hash object or NULL on failure |
librdf_hash* librdf_new_hash_from_hash (librdf_hash *old_hash);
Copy Constructor - create a new librdf_hash object from an existing one.
|
the hash to use to construct the hash |
Returns : |
a new librdf_hash object or NULL on failure |
void librdf_free_hash (librdf_hash *hash);
Destructor - destroy a librdf_hash object.
|
hash object |
char* librdf_hash_get (librdf_hash *hash, const char *key);
Retrieve one value from hash for a given key as string.
The value returned is from newly allocated memory which the caller must free.
|
hash object |
|
pointer to key |
Returns : |
the value or NULL on failure |
int librdf_hash_get_as_boolean (librdf_hash *hash, const char *key);
Lookup a hash key and decode value as a boolean.
|
librdf_hash object |
|
key string to look up |
Returns : |
>0 (for true), 0 (for false) or <0 (for key not found or not known boolean value) |
long librdf_hash_get_as_long (librdf_hash *hash, const char *key);
Lookup a hash key and decode value as a long.
|
librdf_hash object |
|
key string to look up |
Returns : |
>0 (for success), <0 (for key not found or not known boolean value) |
char* librdf_hash_get_del (librdf_hash *hash, const char *key);
Retrieve one value from hash for a given key as string and remove all values with that key.
The value returned is from newly allocated memory which the caller must free.
|
hash object |
|
pointer to key |
Returns : |
the value or NULL on failure |
int librdf_hash_put_strings (librdf_hash *hash, const char *key, const char *value);
Insert key/value pairs into the hash as strings.
The key and values are copied into the hash, no sharing i s done.
|
hash object |
|
key |
|
value |
Returns : |
non 0 on failure |
void librdf_hash_print (librdf_hash *hash, FILE *fh);
Pretty print the hash to a file descriptor.
|
the hash |
|
file handle |
void librdf_hash_print_keys (librdf_hash *hash, FILE *fh);
Pretty print the keys to a file descriptor.
|
the hash |
|
file handle |
void librdf_hash_print_values (librdf_hash *hash, const char *key_string, FILE *fh);
Pretty print the values of one key to a file descriptor.
|
the hash |
|
the key as a string |
|
file handle |
unsigned char* librdf_hash_interpret_template (unsigned char *template_string, librdf_hash *dictionary, unsigned char *prefix, unsigned char *suffix);
Interpret keys in a template string to their value in a dictionary.
Can be used to do variable substitution for a string where
the syntax that marks the variable is defined by the prefix
and suffix
strings, and the variables are stored in the dictionary
hash table.
|
template string to interprate |
|
dictionary of key/values to substitute |
|
prefix to mark a key in the template |
|
suffix to mark a key in the template |
Returns : |
Newly allocated string, or NULL on failure |