root/library/bdm/base/libconfig/lib/parsectx.h @ 706

Revision 706, 1.6 kB (checked in by smidl, 15 years ago)

eol-native

  • Property svn:eol-style set to native
Line 
1/* ----------------------------------------------------------------------------
2   libconfig - A library for processing structured configuration files
3   Copyright (C) 2005-2009  Mark A Lindner
4
5   This file is part of libconfig.
6
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public License
9   as published by the Free Software Foundation; either version 2.1 of
10   the License, or (at your option) any later version.
11
12   This library is distributed in the hope that it will be useful, but
13   WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   Lesser General Public License for more details.
16
17   You should have received a copy of the GNU Library General Public
18   License along with this library; if not, see
19   <http://www.gnu.org/licenses/>.
20   ----------------------------------------------------------------------------
21*/
22
23#ifndef __libconfig_parsectx_h
24#define __libconfig_parsectx_h
25
26#include "libconfig.h"
27#include "strbuf.h"
28
29struct parse_context
30{
31  config_t *config;
32  config_setting_t *parent;
33  config_setting_t *setting;
34  char *name;
35  strbuf_t string;
36};
37
38#define parsectx_init(C)                        \
39  memset((C), 0, sizeof(struct parse_context))
40#define parsectx_cleanup(C)                             \
41  free((void *)(strbuf_release(&((C)->string))))
42
43#define parsectx_append_string(C, S)            \
44  strbuf_append(&((C)->string), (S))
45#define parsectx_take_string(C)                 \
46  strbuf_release(&((C)->string))
47
48#endif /* __libconfig_parsectx_h */
Note: See TracBrowser for help on using the browser.