![]() |
![]() |
![]() |
librest Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum RestMemoryUse; RestParam; RestParam * rest_param_new_string (const char *name
,RestMemoryUse use
,const char *string
); RestParam * rest_param_new_full (const char *name
,RestMemoryUse use
,gconstpointer data
,gsize length
,const char *content_type
,const char *filename
); RestParam * rest_param_new_with_owner (const char *name
,gconstpointer data
,gsize length
,const char *content_type
,const char *filename
,gpointer owner
,GDestroyNotify owner_dnotify
); gboolean rest_param_is_string (RestParam *param
); const char * rest_param_get_name (RestParam *param
); const char * rest_param_get_content_type (RestParam *param
); const char * rest_param_get_file_name (RestParam *param
); gconstpointer rest_param_get_content (RestParam *param
); gsize rest_param_get_content_length (RestParam *param
); RestParam * rest_param_ref (RestParam *param
); void rest_param_unref (RestParam *param
);
typedef enum { REST_MEMORY_STATIC, REST_MEMORY_TAKE, REST_MEMORY_COPY, } RestMemoryUse;
RestParam * rest_param_new_string (const char *name
,RestMemoryUse use
,const char *string
);
A convience constructor to create a RestParam from a given UTF-8 string. The resulting RestParam will have a content type of "text/plain".
|
the parameter name |
|
the RestMemoryUse describing how the memory can be used |
|
the parameter value |
Returns : |
a new RestParam. |
RestParam * rest_param_new_full (const char *name
,RestMemoryUse use
,gconstpointer data
,gsize length
,const char *content_type
,const char *filename
);
Create a new RestParam called name
with length
bytes of data
as the
value. content_type
is the type of the data as a MIME type, for example
"text/plain" for simple string parameters.
If the parameter is a file upload it can be passed as filename
.
|
the parameter name |
|
the RestMemoryUse describing how the memory can be used |
|
a pointer to the start of the data. [array length=length][element-type guint8] |
|
the length of the data |
|
the content type of the data |
|
the original filename, or NULL
|
Returns : |
a new RestParam. |
RestParam * rest_param_new_with_owner (const char *name
,gconstpointer data
,gsize length
,const char *content_type
,const char *filename
,gpointer owner
,GDestroyNotify owner_dnotify
);
Create a new RestParam called name
with length
bytes of data
as the
value. content_type
is the type of the data as a MIME type, for example
"text/plain" for simple string parameters.
If the parameter is a file upload it can be passed as filename
.
When the RestParam is freed, it will call owner_dnotify
, passing owner
to
it. This allows you to do something like this:
1 2 3 4 5 6 7 8 9 10 11 |