XmlRpcMethodValue * vortex_xml_rpc_method_value_new ( VortexCtx ctx,
XmlRpcParamType  type,
axlPointer  value 
)

Allows to create a new XmlRpcMethodValue object from the given type and the given value.

You can use this function to create parameters to be added to method objects (XmlRpcMethodCall) using:

You can also skip this function and go directly to add the value being created by this function to the method call using:

This function returns a new XmlRpcMethodValue reference which should be unrefered using vortex_xml_rpc_method_value_free.

This function will not perform a local copy for the given value unless XML_RPC_STRING_VALUE is provided. In that case a local copy is made to enable the caller to unref the value provided just returing from this function.

This particular behavior is explained from the fact the other types like bool or int doesn't required to perform a local copy, and array and struct values are allocated through the provided interface creating a copy.

But, there is no way to figure out if the string value received was allocated on the heap or it is an stack activated value or simple an static string.

Here are some examples:

1 XmlRpcMethodValue * value;
2 
3 // Create a method value representing an integer value
4 value = vortex_xml_rpc_method_value_new (XML_RPC_INT_VALUE,
5  PTR_TO_INT(10));
6 // free the value created
7 vortex_xml_rpc_method_value_free (value);
8 
9 // Create a method value representing an string
10 value = vortex_xml_rpc_method_value_new (XML_RPC_STRING_VALUE,
11  "test");
12 // free the value created
13 vortex_xml_rpc_method_value_free (value);
Parameters
ctxThe context where the method value is being created.
typeThe type to be created.
valueThe value associated with the type being created
Returns
A new reference to XmlRpcMethodValue object or NULL if it fails. The function could only fail if the given value is NULL or the type provided is not a valid value found in the enumeration, not including XML_RPC_UNKNOWN_VALUE.

References XML_RPC_ARRAY_VALUE, XML_RPC_BASE64_REF_VALUE, XML_RPC_BASE64_VALUE, XML_RPC_BOOLEAN_VALUE, XML_RPC_DATE_VALUE, XML_RPC_DOUBLE_VALUE, XML_RPC_EMPTY_STR, XML_RPC_INT_VALUE, XML_RPC_NONE_VALUE, XML_RPC_STRING_REF_VALUE, XML_RPC_STRING_VALUE, XML_RPC_STRUCT_VALUE, and XML_RPC_UNKNOWN_VALUE.

Referenced by vortex_xml_rpc_method_call_create_value(), vortex_xml_rpc_method_value_new_bool(), vortex_xml_rpc_method_value_new_double(), and vortex_xml_rpc_method_value_new_int().