doc: updated italian translations
[adg.git] / src / adg / adg-pair.c
blob8da7920d29227b9d68ec73a8b222304e0a233ee5
1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007,2008,2009,2010,2011,2012 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 /**
22 * SECTION:adg-pair
23 * @Section_Id:AdgPair
24 * @title: AdgPair
25 * @short_description: A wrapper for #CpmlPair
27 * AdgPair is a wrapper in #GType syntax of the #CpmlPair struct.
29 * Since: 1.0
30 **/
32 /**
33 * AdgPair:
35 * Another name for #CpmlPair: check its documentation for the
36 * fields description and visibility details.
38 * Since: 1.0
39 **/
42 #include "adg-internal.h"
43 #include <string.h>
46 GType
47 adg_pair_get_type(void)
49 static GType pair_type = 0;
51 if (G_UNLIKELY(pair_type == 0))
52 pair_type = g_boxed_type_register_static("AdgPair",
53 (GBoxedCopyFunc) adg_pair_dup,
54 g_free);
56 return pair_type;
59 /**
60 * adg_pair_copy:
61 * @pair: the destination #AdgPair
62 * @src: the source #AdgPair
64 * Copies @src in @pair. It works in the same way as
65 * cpml_pair_copy() but performing argument validation
66 * before proceeding.
68 * Since: 1.0
69 **/
70 void
71 adg_pair_copy(AdgPair *pair, const AdgPair *src)
73 g_return_if_fail(pair != NULL);
74 g_return_if_fail(src != NULL);
76 memcpy(pair, src, sizeof(AdgPair));
79 /**
80 * adg_pair_dup:
81 * @pair: an #AdgPair structure
83 * Duplicates @pair.
85 * Returns: (transfer full): the duplicate of @pair: must be freed with g_free() when no longer needed.
87 * Since: 1.0
88 **/
89 AdgPair *
90 adg_pair_dup(const AdgPair *pair)
92 /* g_memdup() returns NULL if pair is NULL */
93 return g_memdup(pair, sizeof(AdgPair));