1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2/*
3 * Copyright (C) 2007 Red Hat, Inc.
4 */
5
6#ifndef __SOUP_VALUE_UTILS_H__
7#define __SOUP_VALUE_UTILS_H__ 1
8
9#include <libsoup/soup-types.h>
10#include <gobject/gvaluecollector.h>
11
12G_BEGIN_DECLS
13
14#define SOUP_VALUE_SETV(val, type, args) \
15G_STMT_START { \
16 char *setv_error = NULL; \
17 \
18 memset (val, 0, sizeof (GValue)); \
19 g_value_init (val, type); \
20 G_VALUE_COLLECT (val, args, G_VALUE_NOCOPY_CONTENTS, &setv_error); \
21 g_free (setv_error); \
22} G_STMT_END
23
24#define SOUP_VALUE_GETV(val, type, args) \
25G_STMT_START { \
26 char *getv_error = NULL; \
27 \
28 G_VALUE_LCOPY (val, args, G_VALUE_NOCOPY_CONTENTS, &getv_error); \
29 g_free (getv_error); \
30} G_STMT_END
31
32SOUP_AVAILABLE_IN_2_4
33SOUP_DEPRECATED_IN_2_52
34GHashTable *soup_value_hash_new (void);
35SOUP_AVAILABLE_IN_2_4
36SOUP_DEPRECATED_IN_2_52
37GHashTable *soup_value_hash_new_with_vals (const char *first_key,
38 ...) G_GNUC_NULL_TERMINATED;
39SOUP_AVAILABLE_IN_2_4
40SOUP_DEPRECATED_IN_2_52
41void soup_value_hash_insert_value (GHashTable *hash,
42 const char *key,
43 GValue *value);
44SOUP_AVAILABLE_IN_2_4
45SOUP_DEPRECATED_IN_2_52
46void soup_value_hash_insert (GHashTable *hash,
47 const char *key,
48 GType type,
49 ...);
50SOUP_AVAILABLE_IN_2_4
51SOUP_DEPRECATED_IN_2_52
52void soup_value_hash_insert_vals (GHashTable *hash,
53 const char *first_key,
54 ...) G_GNUC_NULL_TERMINATED;
55SOUP_AVAILABLE_IN_2_4
56SOUP_DEPRECATED_IN_2_52
57gboolean soup_value_hash_lookup (GHashTable *hash,
58 const char *key,
59 GType type,
60 ...);
61SOUP_AVAILABLE_IN_2_4
62SOUP_DEPRECATED_IN_2_52
63gboolean soup_value_hash_lookup_vals (GHashTable *hash,
64 const char *first_key,
65 ...) G_GNUC_NULL_TERMINATED;
66
67SOUP_AVAILABLE_IN_2_4
68SOUP_DEPRECATED_IN_2_52
69GValueArray *soup_value_array_from_args (va_list args);
70SOUP_AVAILABLE_IN_2_4
71SOUP_DEPRECATED_IN_2_52
72gboolean soup_value_array_to_args (GValueArray *array,
73 va_list args);
74
75SOUP_AVAILABLE_IN_2_4
76SOUP_DEPRECATED_IN_2_52
77GValueArray *soup_value_array_new (void);
78SOUP_AVAILABLE_IN_2_4
79SOUP_DEPRECATED_IN_2_52
80GValueArray *soup_value_array_new_with_vals (GType first_type,
81 ...) G_GNUC_NULL_TERMINATED;
82
83SOUP_AVAILABLE_IN_2_4
84SOUP_DEPRECATED_IN_2_52
85void soup_value_array_insert (GValueArray *array,
86 guint index_,
87 GType type,
88 ...);
89SOUP_AVAILABLE_IN_2_4
90SOUP_DEPRECATED_IN_2_52
91void soup_value_array_append (GValueArray *array,
92 GType type,
93 ...);
94SOUP_AVAILABLE_IN_2_4
95SOUP_DEPRECATED_IN_2_52
96void soup_value_array_append_vals (GValueArray *array,
97 GType first_type,
98 ...) G_GNUC_NULL_TERMINATED;
99SOUP_AVAILABLE_IN_2_4
100SOUP_DEPRECATED_IN_2_52
101gboolean soup_value_array_get_nth (GValueArray *array,
102 guint index_,
103 GType type,
104 ...);
105
106
107SOUP_AVAILABLE_IN_2_4
108SOUP_DEPRECATED_IN_2_52
109GType soup_byte_array_get_type (void);
110#define SOUP_TYPE_BYTE_ARRAY (soup_byte_array_get_type ())
111
112G_END_DECLS
113
114#endif /* __SOUP_VALUE_UTILS_H__ */
115