• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
12 G_BEGIN_DECLS
13 
14 #define SOUP_VALUE_SETV(val, type, args)				\
15 G_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)				\
25 G_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 
32 SOUP_AVAILABLE_IN_2_4
33 SOUP_DEPRECATED_IN_2_52
34 GHashTable  *soup_value_hash_new            (void);
35 SOUP_AVAILABLE_IN_2_4
36 SOUP_DEPRECATED_IN_2_52
37 GHashTable  *soup_value_hash_new_with_vals  (const char  *first_key,
38 					     ...) G_GNUC_NULL_TERMINATED;
39 SOUP_AVAILABLE_IN_2_4
40 SOUP_DEPRECATED_IN_2_52
41 void         soup_value_hash_insert_value   (GHashTable  *hash,
42 					     const char  *key,
43 					     GValue      *value);
44 SOUP_AVAILABLE_IN_2_4
45 SOUP_DEPRECATED_IN_2_52
46 void         soup_value_hash_insert         (GHashTable  *hash,
47 					     const char  *key,
48 					     GType        type,
49 					     ...);
50 SOUP_AVAILABLE_IN_2_4
51 SOUP_DEPRECATED_IN_2_52
52 void         soup_value_hash_insert_vals    (GHashTable  *hash,
53 					     const char  *first_key,
54 					     ...) G_GNUC_NULL_TERMINATED;
55 SOUP_AVAILABLE_IN_2_4
56 SOUP_DEPRECATED_IN_2_52
57 gboolean     soup_value_hash_lookup         (GHashTable  *hash,
58 					     const char  *key,
59 					     GType        type,
60 					     ...);
61 SOUP_AVAILABLE_IN_2_4
62 SOUP_DEPRECATED_IN_2_52
63 gboolean     soup_value_hash_lookup_vals    (GHashTable  *hash,
64 					     const char  *first_key,
65 					     ...) G_GNUC_NULL_TERMINATED;
66 
67 SOUP_AVAILABLE_IN_2_4
68 SOUP_DEPRECATED_IN_2_52
69 GValueArray *soup_value_array_from_args     (va_list      args);
70 SOUP_AVAILABLE_IN_2_4
71 SOUP_DEPRECATED_IN_2_52
72 gboolean     soup_value_array_to_args       (GValueArray *array,
73 					     va_list      args);
74 
75 SOUP_AVAILABLE_IN_2_4
76 SOUP_DEPRECATED_IN_2_52
77 GValueArray *soup_value_array_new           (void);
78 SOUP_AVAILABLE_IN_2_4
79 SOUP_DEPRECATED_IN_2_52
80 GValueArray *soup_value_array_new_with_vals (GType        first_type,
81 					     ...) G_GNUC_NULL_TERMINATED;
82 
83 SOUP_AVAILABLE_IN_2_4
84 SOUP_DEPRECATED_IN_2_52
85 void         soup_value_array_insert        (GValueArray *array,
86 					     guint        index_,
87 					     GType        type,
88 					     ...);
89 SOUP_AVAILABLE_IN_2_4
90 SOUP_DEPRECATED_IN_2_52
91 void         soup_value_array_append        (GValueArray *array,
92 					     GType        type,
93 					     ...);
94 SOUP_AVAILABLE_IN_2_4
95 SOUP_DEPRECATED_IN_2_52
96 void         soup_value_array_append_vals   (GValueArray *array,
97 					     GType        first_type,
98 					     ...) G_GNUC_NULL_TERMINATED;
99 SOUP_AVAILABLE_IN_2_4
100 SOUP_DEPRECATED_IN_2_52
101 gboolean     soup_value_array_get_nth       (GValueArray *array,
102 					     guint        index_,
103 					     GType        type,
104 					     ...);
105 
106 
107 SOUP_AVAILABLE_IN_2_4
108 SOUP_DEPRECATED_IN_2_52
109 GType        soup_byte_array_get_type       (void);
110 #define SOUP_TYPE_BYTE_ARRAY (soup_byte_array_get_type ())
111 
112 G_END_DECLS
113 
114 #endif /* __SOUP_VALUE_UTILS_H__ */
115