~ubuntu-branches/debian/stretch/libxr/stretch

« back to all changes in this revision

Viewing changes to include/xr-value-utils.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Boucher
  • Date: 2009-10-14 00:52:51 UTC
  • Revision ID: james.westby@ubuntu.com-20091014005251-epx05xv5ef9188q0
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright 2006-2008 Ondrej Jirman <ondrej.jirman@zonio.net>
 
3
 * 
 
4
 * This file is part of libxr.
 
5
 *
 
6
 * Libxr is free software: you can redistribute it and/or modify it under the
 
7
 * terms of the GNU Lesser General Public License as published by the Free
 
8
 * Software Foundation, either version 2 of the License, or (at your option) any
 
9
 * later version.
 
10
 *
 
11
 * Libxr is distributed in the hope that it will be useful, but WITHOUT ANY
 
12
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 
13
 * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 
14
 * details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public License
 
17
 * along with libxr.  If not, see <http://www.gnu.org/licenses/>.
 
18
 *
 
19
 * Author: David Lee <live4thee@gmail.com> (2007-12-27)
 
20
 * Small cleanups by Ondrej Jirman <ondrej.jirman@zonio.net>.
 
21
 */
 
22
 
 
23
/** @file xr-value-utils.h
 
24
 *
 
25
 * xr_value parser/builder.
 
26
 *
 
27
 * API which accepts a subset of xmlrpc-c format string. c.f.
 
28
 * http://xmlrpc-c.sourceforge.net/doc/libxmlrpc.html#formatstring
 
29
 *
 
30
 * Supported specifiers:
 
31
 *  i -- int
 
32
 *  b -- boolean
 
33
 *  d -- double
 
34
 *  s -- string
 
35
 *  A -- array
 
36
 *  S -- struct
 
37
 *  ( -- begin of an array
 
38
 *  ) -- end of an array
 
39
 *  { -- begin of a struct
 
40
 *  } -- end of a struct
 
41
 *  : -- key-value pair separator in a struct
 
42
 *  , -- separator for members of a struct
 
43
 *  * -- tagging the end of a struct, or ingore rest items of an array
 
44
 */
 
45
 
 
46
#ifndef __XR_VALUE_UTILS_H__
 
47
#define __XR_VALUE_UTILS_H__
 
48
 
 
49
#include <xr-value.h>
 
50
 
 
51
G_BEGIN_DECLS
 
52
 
 
53
/** Build a value node from format string.
 
54
 *
 
55
 * @param fmt The format string.
 
56
 *
 
57
 * @return A NULL pointer indicates a failure.
 
58
 */
 
59
xr_value* xr_value_build(const char* fmt, ...);
 
60
 
 
61
/** Parse a value node using format string.
 
62
 *
 
63
 * @param value The node to be parsed.
 
64
 * @param fmt The format string.
 
65
 *
 
66
 * @return TRUE on success, FALSE on failure.
 
67
 */
 
68
gboolean xr_value_parse(xr_value* value, const char* fmt, ...);
 
69
 
 
70
G_END_DECLS
 
71
 
 
72
#endif