summaryrefslogtreecommitdiffstats
path: root/libcsoap/csoapparam.h
blob: 75889e4f340ecc2545d25cf68914d2e0397b7681 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/******************************************************************
 *  $Id: csoapparam.h,v 1.2 2003/11/13 10:44:10 snowdrop Exp $
 *
 * CSOAP Project:  A SOAP client/server library in C
 * Copyright (C) 2003  Ferhat Ayaz
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 * 
 * Email: ayaz@jprogrammer.net
 ******************************************************************/
#ifndef CSOAP_PARAM_H
#define CSOAP_PARAM_H

#include "libcsoap/csoapxml.h"


typedef HSOAPXML HSOAPPARAM;


#define SOAP_MAX_STRING_BUFFER  1054


/**
 * Creates a string soap parameter
 *
 * <LI>Default type: "xsd:string"
 *
 * @param parent the parent param object
 * @param name the parameter name
 * @param format the parameter value 
 * 
 * @return handle to a parameter object if
 *  the creation was successfull, NULL otherwise
 */
HSOAPPARAM SoapParamCreateString( HSOAPPARAM parent, const char *name, 
				  const char *format,  ...);


/**
 * Creates an integer soap parameter
 *
 * <LI>Default type: "xsd:integer"
 *
 * @param parent the parent param object
 * @param name the parameter name
 * @param value the parameter value 
 * 
 * @return handle to a parameter object if
 *  the creation was successfull, NULL otherwise
 */
HSOAPPARAM SoapParamCreateInt( HSOAPPARAM parent, const char *name,
			       int value);


/**
 * Creates a double soap parameter
 *
 * <LI>Default type: "xsd:double"
 *
 * @param parent the parent param object
 * @param name the parameter name
 * @param value the parameter value 
 * 
 * @return handle to a parameter object if
 *  the creation was successfull, NULL otherwise
 */
HSOAPPARAM SoapParamCreateDouble( HSOAPPARAM parent, const char *name,
				  double value);


/**
 * Sets the parameter value. 
 *
 * @param param the parameter object
 * @param type a custom type name
 * @param format value of the parameter
 */
void SoapParamSetValue(HSOAPPARAM param,const char* type,
		       const char* format,  ...);


/**
 * Get the value of a soap parameter 
 * in string format
 *
 * @param param the soap parameter object
 * @param buffer an allocated character buffer
 *  to receive the content. If this is NULL,
 *  this function will return the size only.
 * 
 * @return size of the content.
 */
int SoapParamGetString(HSOAPPARAM param, char *buffer);   


/**
 * Convert the value of a soap parameter
 * to string. Note that this is the same
 * as SoapParamGetString except that you
 * must free the result manually.
 *
 * @param param the soap parameter object
 * 
 * @return the parameter in string format.
 *  Must be free manually!.
 */
char* SoapParamToString(HSOAPPARAM param);


/**
 * Get the value of a soap parameter
 *  in integer format
 * 
 * @param param the soap parameter object
 * @return the param content as integer
 */
int SoapParamGetInt(HSOAPPARAM param);


/**
 * Get the value of a soap parameter
 *  in double format
 * 
 * @param param the soap parameter object
 * @return the param content as double
 */
double SoapParamGetDouble(HSOAPPARAM param);


/**
 * Get the children parameter nodes.
 * This acts actually like an xml node.
 * 
 * @param param the soap parameter object
 * @return handle to the first child node
 */
HSOAPPARAM SoapParamGetChildren(HSOAPPARAM param);


/**
 * Get the next parameter.
 * This acts actually like an xml node.
 * 
 * @param param the soap parameter object
 * @return handle to the next node
 */
HSOAPPARAM SoapParamGetNext(HSOAPPARAM param);


/**
 * Checks if the type is equals with
 * the given one.
 *
 * @param param the param to check
 * @param type the type to check
 * 
 * @return 0 if the parameter type not equals to 'type'
 */
int SoapParamTypeIs(HSOAPPARAM param, const char* type);


/**
 * Returns parameters type.
 *
 * @param param the param to return its type
 * 
 * @return returns parameters type
 */
char* SoapParamGetType(HSOAPPARAM param);


/**
 * Creates a new parameter node.
 * This is used internally.
 *
 * @param parent the parent soap parameter object
 * @param type the parameter type
 * @param ns the namespace of the parameter
 * @param name name of the parameter
 * @param format value of the parameter
 *
 * @return A newly created soap parameter object
 */
HSOAPPARAM SoapParamCreate(HSOAPPARAM parent, const char *type,
			    const char *ns, const char *name,
			    const char *format,   ...);

#endif