Replace functions which called once with their bodies
[pidgin-git.git] / libpurple / purpleaccountusersplit.c
blobb35d262ae87a6283e1feb529742616a3dd63ff40
1 /* purple
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #include "purpleaccountusersplit.h"
24 /******************************************************************************
25 * Structs
26 *****************************************************************************/
27 struct _PurpleAccountUserSplit {
28 gchar *text;
29 gchar *default_value;
30 gchar field_sep;
31 gboolean reverse;
32 gboolean constant;
35 /******************************************************************************
36 * Public API
37 *****************************************************************************/
38 G_DEFINE_BOXED_TYPE(
39 PurpleAccountUserSplit,
40 purple_account_user_split,
41 purple_account_user_split_copy,
42 purple_account_user_split_destroy
45 PurpleAccountUserSplit *
46 purple_account_user_split_new(const gchar *text, const gchar *default_value, gchar sep)
48 PurpleAccountUserSplit *split;
50 g_return_val_if_fail(text != NULL, NULL);
51 g_return_val_if_fail(sep != 0, NULL);
53 split = g_new0(PurpleAccountUserSplit, 1);
55 split->text = g_strdup(text);
56 split->field_sep = sep;
57 split->default_value = g_strdup(default_value);
58 split->reverse = TRUE;
60 return split;
63 PurpleAccountUserSplit *
64 purple_account_user_split_copy(PurpleAccountUserSplit *split) {
65 PurpleAccountUserSplit *newsplit = NULL;
67 newsplit = purple_account_user_split_new(split->text, split->default_value, split->field_sep);
69 newsplit->reverse = split->reverse;
70 newsplit->constant = split->constant;
72 return newsplit;
76 void
77 purple_account_user_split_destroy(PurpleAccountUserSplit *split)
79 g_return_if_fail(split != NULL);
81 g_free(split->text);
82 g_free(split->default_value);
83 g_free(split);
86 const gchar *
87 purple_account_user_split_get_text(const PurpleAccountUserSplit *split)
89 g_return_val_if_fail(split != NULL, NULL);
91 return split->text;
94 const gchar *
95 purple_account_user_split_get_default_value(const PurpleAccountUserSplit *split)
97 g_return_val_if_fail(split != NULL, NULL);
99 return split->default_value;
102 char
103 purple_account_user_split_get_separator(const PurpleAccountUserSplit *split)
105 g_return_val_if_fail(split != NULL, 0);
107 return split->field_sep;
110 gboolean
111 purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split)
113 g_return_val_if_fail(split != NULL, FALSE);
115 return split->reverse;
118 void
119 purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse)
121 g_return_if_fail(split != NULL);
123 split->reverse = reverse;
126 gboolean
127 purple_account_user_split_is_constant(const PurpleAccountUserSplit *split)
129 g_return_val_if_fail(split != NULL, FALSE);
131 return split->constant;
134 void
135 purple_account_user_split_set_constant(PurpleAccountUserSplit *split,
136 gboolean constant)
138 g_return_if_fail(split != NULL);
140 split->constant = constant;