txt_configfile.h 1.48 KB
Newer Older
Philip Carns's avatar
Philip Carns committed
1
2
3
4
5
6
/*
 * Copyright (C) 2013 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
 */

7
8
9
10
11
#ifndef SRC_COMMON_MODELCONFIG_TXTFILE_CONFIGFILE_H
#define SRC_COMMON_MODELCONFIG_TXTFILE_CONFIGFILE_H


#include <stdio.h>
12
#include <codes/configfile.h>
13
14
15
16
17
18
19
20
21
22
23

#ifdef __cplusplus
extern "C" {
#endif

/**
 * ConfigFile implementation that stores data in a text file 
 */


/**
24
 * returns ConfigVTable, if all is OK *err is set to 0, 
25
26
 * otherwise *err is set to a pointer to the error string 
 * (which needs to be freed by the user)
27
 * NOTE that even if an error occurred, a partial ConfigVTable tree
28
29
 * can be returned.
 */
30
struct ConfigVTable * txtfile_openConfig (const char * filename, char ** err);
31
32

/**
33
 * returns ConfigVTable, if all is OK *err is set to 0, 
34
35
 * otherwise *err is set to a pointer to the error string 
 * (which needs to be freed by the user)
36
 * NOTE that even if an error occurred, a partial ConfigVTable tree
37
38
 * can be returned.
 */
39
struct ConfigVTable * txtfile_openStream (FILE * f, char ** err);
40
41
42


/**
43
 * Write ConfigVTable to disk (in a format supported by _open).
44
45
46
47
 * Returns >=0 if all went OK, < 0 otherwise in which 
 * case *err is set to a pointer to an error string, which needs to be
 * freed by the user.
 */
48
int txtfile_writeConfig (struct ConfigVTable * h, SectionHandle h2, FILE * out, char ** err);
49
50
51
52
53
54

#ifdef __cplusplus
} /* extern "C"  */
#endif

#endif
Philip Carns's avatar
Philip Carns committed
55
56
57
58
59
60
61
62
63

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ts=8 sts=4 sw=4 expandtab
 */