2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi <http://quvi.sourceforge.net/>.
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
21 /** @file http_metainfo_get.c */
30 #include "_quvi_http_metainfo_s.h"
32 static QuviError
_http_metainfo_get(_quvi_http_metainfo_t v
,
33 QuviHTTPMetaInfoProperty n
, ...)
42 type
= QUVI_HTTP_METAINFO_PROPERTY_TYPE_MASK
& (gint
) n
;
51 case QUVI_HTTP_METAINFO_PROPERTY_TYPE_STRING
:
52 sp
= va_arg(arg
, gchar
**);
54 rc
= QUVI_ERROR_INVALID_ARG
;
56 case QUVI_HTTP_METAINFO_PROPERTY_TYPE_DOUBLE
:
57 dp
= va_arg(arg
, gdouble
*);
59 rc
= QUVI_ERROR_INVALID_ARG
;
62 rc
= QUVI_ERROR_INVALID_ARG
;
72 case QUVI_HTTP_METAINFO_PROPERTY_FILE_EXTENSION
:
73 *sp
= v
->file_ext
->str
;
75 case QUVI_HTTP_METAINFO_PROPERTY_LENGTH_BYTES
:
76 *dp
= v
->length_bytes
;
78 case QUVI_HTTP_METAINFO_PROPERTY_CONTENT_TYPE
:
79 *sp
= v
->content_type
->str
;
82 rc
= QUVI_ERROR_INVALID_ARG
;
88 /** @brief Return a HTTP meta-info property
89 @sa @ref http_metainfo
90 @ingroup http_metainfo
92 void quvi_http_metainfo_get(quvi_http_metainfo_t handle
,
93 QuviHTTPMetaInfoProperty property
, ...)
95 _quvi_http_metainfo_t v
;
100 /* If G_DISABLE_CHECKS is defined then the check is not performed. */
101 g_return_if_fail(handle
!= NULL
);
103 va_start(arg
, property
);
104 p
= va_arg(arg
, gpointer
);
107 v
= (_quvi_http_metainfo_t
) handle
;
110 q
->status
.rc
= _http_metainfo_get(v
, property
, p
);
113 /* vim: set ts=2 sw=2 tw=72 expandtab: */