2 * beagle-hits-subtracted-response.c
4 * Copyright (C) 2005 Novell, Inc.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
29 #include <sys/types.h>
30 #include <sys/socket.h>
33 #include "beagle-hits-subtracted-response.h"
34 #include "beagle-private.h"
37 GSList
*uris
; /* of char * */
38 } BeagleHitsSubtractedResponsePrivate
;
40 #define BEAGLE_HITS_SUBTRACTED_RESPONSE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BEAGLE_TYPE_HITS_SUBTRACTED_RESPONSE, BeagleHitsSubtractedResponsePrivate))
42 static BeagleResponseClass
*parent_class
= NULL
;
44 G_DEFINE_TYPE (BeagleHitsSubtractedResponse
, beagle_hits_subtracted_response
, BEAGLE_TYPE_RESPONSE
)
47 beagle_hits_subtracted_response_finalize (GObject
*obj
)
49 BeagleHitsSubtractedResponsePrivate
*priv
= BEAGLE_HITS_SUBTRACTED_RESPONSE_GET_PRIVATE (obj
);
51 g_slist_foreach (priv
->uris
, (GFunc
)g_free
, NULL
);
52 g_slist_free (priv
->uris
);
54 if (G_OBJECT_CLASS (parent_class
)->finalize
)
55 G_OBJECT_CLASS (parent_class
)->finalize (obj
);
59 end_uri (BeagleParserContext
*ctx
)
61 BeagleHitsSubtractedResponse
*response
= BEAGLE_HITS_SUBTRACTED_RESPONSE (_beagle_parser_context_get_response (ctx
));
62 BeagleHitsSubtractedResponsePrivate
*priv
= BEAGLE_HITS_SUBTRACTED_RESPONSE_GET_PRIVATE (response
);
64 priv
->uris
= g_slist_prepend (priv
->uris
, _beagle_parser_context_get_text_buffer (ctx
));
72 static BeagleParserHandler parser_handlers
[] = {
87 beagle_hits_subtracted_response_class_init (BeagleHitsSubtractedResponseClass
*klass
)
89 GObjectClass
*obj_class
= G_OBJECT_CLASS (klass
);
91 parent_class
= g_type_class_peek_parent (klass
);
93 obj_class
->finalize
= beagle_hits_subtracted_response_finalize
;
95 _beagle_response_class_set_parser_handlers (BEAGLE_RESPONSE_CLASS (klass
),
98 g_type_class_add_private (klass
, sizeof (BeagleHitsSubtractedResponsePrivate
));
102 beagle_hits_subtracted_response_init (BeagleHitsSubtractedResponse
*response
)
107 * beagle_hits_subtracted_response_get_uris:
108 * @response: a #BeagleHitsSubtractedResponse
110 * Fetches the list of hit uris contained in the given #BeagleHitsSubtractedResponse. The list should not be modified or freed.
112 * Return value: A list of uri strings.
115 beagle_hits_subtracted_response_get_uris (BeagleHitsSubtractedResponse
*response
)
117 BeagleHitsSubtractedResponsePrivate
*priv
;
119 g_return_val_if_fail (BEAGLE_IS_HITS_SUBTRACTED_RESPONSE (response
), NULL
);
121 priv
= BEAGLE_HITS_SUBTRACTED_RESPONSE_GET_PRIVATE (response
);