~ubuntu-branches/ubuntu/vivid/librest/vivid-proposed

« back to all changes in this revision

Viewing changes to rest/rest-param.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2010-10-20 06:48:27 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20101020064827-xke57n8ff9ywlm11
Tags: 0.7.2+git20100820.ad370df7-1ubuntu1
* Sync package from Debian (LP: #646960).
* fix-missing-libs-binutils-gold.patch: fix FTBFS with binutils-gold by
  patching Makefile.am to add explicitly 2 libs (libgobject-2.0 and
  libglib-2.0).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * librest - RESTful web services access
 
3
 * Copyright (c) 2010 Intel Corporation.
 
4
 *
 
5
 * Authors: Ross Burton <ross@linux.intel.com>
 
6
 *          Rob Bradford <rob@linux.intel.com>
 
7
 *
 
8
 * RestParam is inspired by libsoup's SoupBuffer
 
9
 * Copyright (C) 2000-2030 Ximian, Inc
 
10
 *
 
11
 * This program is free software; you can redistribute it and/or modify it
 
12
 * under the terms and conditions of the GNU Lesser General Public License,
 
13
 * version 2.1, as published by the Free Software Foundation.
 
14
 *
 
15
 * This program is distributed in the hope it will be useful, but WITHOUT ANY
 
16
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
17
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
 
18
 * more details.
 
19
 *
 
20
 * You should have received a copy of the GNU Lesser General Public License
 
21
 * along with this program; if not, write to the Free Software Foundation,
 
22
 * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 
23
 *
 
24
 */
 
25
 
 
26
#ifndef _REST_PARAM
 
27
#define _REST_PARAM
 
28
 
 
29
#include <glib-object.h>
 
30
 
 
31
G_BEGIN_DECLS
 
32
 
 
33
/**
 
34
 * RestMemoryUse:
 
35
 * @REST_MEMORY_STATIC: the memory block can be assumed to always exist for the
 
36
 * lifetime of the parameter, #RestParam will use it directly.
 
37
 * @REST_MEMORY_TAKE: #RestParam will take ownership of the memory block, and
 
38
 * g_free() it when it isn't used.
 
39
 * @REST_MEMORY_COPY: #RestParam will make a copy of the memory block.
 
40
 */
 
41
typedef enum {
 
42
  REST_MEMORY_STATIC,
 
43
  REST_MEMORY_TAKE,
 
44
  REST_MEMORY_COPY,
 
45
} RestMemoryUse;
 
46
 
 
47
 
 
48
typedef struct _RestParam RestParam;
 
49
 
 
50
RestParam *rest_param_new_string (const char    *name,
 
51
                                  RestMemoryUse  use,
 
52
                                  const char    *string);
 
53
 
 
54
RestParam *rest_param_new_full (const char     *name,
 
55
                                RestMemoryUse   use,
 
56
                                gconstpointer   data,
 
57
                                gsize           length,
 
58
                                const char     *content_type,
 
59
                                const char     *filename);
 
60
 
 
61
RestParam *rest_param_new_with_owner (const char     *name,
 
62
                                      gconstpointer   data,
 
63
                                      gsize           length,
 
64
                                      const char     *content_type,
 
65
                                      const char     *filename,
 
66
                                      gpointer        owner,
 
67
                                      GDestroyNotify  owner_dnotify);
 
68
 
 
69
 
 
70
gboolean rest_param_is_string (RestParam *param);
 
71
 
 
72
const char *rest_param_get_name (RestParam *param);
 
73
const char *rest_param_get_content_type (RestParam *param);
 
74
const char *rest_param_get_file_name (RestParam *param);
 
75
gconstpointer rest_param_get_content (RestParam *param);
 
76
gsize rest_param_get_content_length (RestParam *param);
 
77
 
 
78
RestParam *rest_param_ref (RestParam *param);
 
79
void rest_param_unref (RestParam *param);
 
80
 
 
81
G_END_DECLS
 
82
 
 
83
#endif /* _REST_PARAM */