Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

keyfile.c File Reference

Functions to manipulate sets of key/value pairs. More...

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "keyfile.h"

Include dependency graph for keyfile.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  _keyfile
 A key file structure. More...

struct  _keyval
 The KeyVal structure and kv_xxx routines implement a linked list. More...


Typedefs

typedef _keyval KeyVal
 The KeyVal structure and kv_xxx routines implement a linked list.

typedef _keyfile KeyFile
 A key file structure.


Functions

KeyValkv_add (KeyVal *kv, char *k, char *v)
 Add a new KeyVal to the end of the list.

void kv_free (KeyVal *kv)
 Frees the KeyVal structure and all following KeyVals in the list.

char * kv_getval (KeyVal *kv, char *k)
 Searches the list rooted at kv, and returns the value for the first matching key.

KeyValkv_new (char *k, char *v)
 Allocate a new KeyVal.

void kv_setval (KeyVal *kv, char *k, char *v)
 Sets the passed value.

char * kf_getvalue (void *kf, char *k)
 Returns the value of the passed variable.

void kf_load (void *kf, char *fn)
 Loads a keyfiles contents from disk.

void * kf_new (char sep)
 Allocate a new key file.

void kf_save (void *kf, char *fn)
 Save the keylist to the file.

void kf_setvalue (void *kf, char *k, char *v)
 Sets the value of the variable.

char * trim (char *s)
 Trims whitespace from the start and end of a string.

void kv_write (KeyVal *kv, char sep, FILE *f)
 Write the keyVal list to a file.


Detailed Description

Functions to manipulate sets of key/value pairs.

Provides two main objects: The key file (kf_xxx finctions), and the key value (kv_xxx functions). Only the key file functions are used outside this file, but the key value functions could be exported if required.

GtkSQL -- an interactive graphical query tool for PostgreSQL Copyright (C) 2003 Darryl Luff

Id:
keyfile.c,v 1.3 2003/01/30 14:26:21 djluff Exp

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Definition in file keyfile.c.


Function Documentation

void kf_setvalue void *    kf,
char *    k,
char *    v
 

Sets the value of the variable.

This call is propagated along the keylist.

Definition at line 230 of file keyfile.c.

References _keyfile::keys, kf_setvalue(), and kv_setval().

Referenced by kf_setvalue().

KeyVal * kv_add KeyVal   kv,
char *    k,
char *    v
 

Add a new KeyVal to the end of the list.

If 'kv' is NULL, a new list is created. Returns the root of the list (either kv or the new root).

Definition at line 55 of file keyfile.c.

References kv_new(), and _keyval::next.

Referenced by kf_load(), and kv_setval().

void kv_setval KeyVal   kv,
char *    k,
char *    v
 

Sets the passed value.

This call is propogated along thr list.

Definition at line 117 of file keyfile.c.

References _keyval::key, kv_add(), _keyval::next, and _keyval::val.

Referenced by kf_setvalue().


Generated on Sun May 9 19:19:23 2004 for GtkSQL by doxygen1.2.18