bygfoot/src/misc.h

148 lines
3.5 KiB
C
Raw Normal View History

2005-10-20 17:45:00 +02:00
/*
2005-11-26 17:52:51 +01:00
misc.h
2005-10-20 17:45:00 +02:00
Bygfoot Football Manager -- a small and simple GTK2-based
football management game.
http://bygfoot.sourceforge.net
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
2004-12-23 13:58:39 +01:00
#ifndef MISC_H
#define MISC_H
#include "bygfoot.h"
2005-07-01 22:51:46 +02:00
#define misc_int_to_char(number) g_strdup_printf("%d", number)
2005-10-27 23:10:15 +02:00
#define query_misc_string_contains(haystack, needle) (g_strstr_len(haystack, strlen(haystack), needle) != NULL)
2005-07-01 22:51:46 +02:00
2004-12-23 13:58:39 +01:00
void
2005-01-09 21:21:22 +01:00
misc_print_error(GError **error, gboolean abort_program);
2004-12-23 13:58:39 +01:00
void
misc_swap_int(gint *first, gint *second);
2005-01-09 21:21:22 +01:00
void
misc_swap_gpointer(gpointer *first, gpointer *second);
GPtrArray*
misc_separate_strings(gchar *string);
2005-01-09 21:21:22 +01:00
GPtrArray*
misc_randomise_g_pointer_array(GPtrArray *array);
void
2005-07-01 22:51:46 +02:00
misc_print_grouped_int(gint number, gchar *buf);
2005-01-09 21:21:22 +01:00
2005-03-08 09:25:46 +01:00
gboolean
2005-10-13 10:52:33 +02:00
query_integer_is_in_array(gint item, gint *array, gint max);
2005-03-08 09:25:46 +01:00
gint
misc_int_compare(gint first, gint second);
2005-03-09 14:10:28 +01:00
gint
misc_float_compare(gfloat first, gfloat second);
const gchar*
misc_strip_definitions_root(gchar *directory);
gboolean
query_misc_string_starts_with(const gchar *string, GList *list);
2005-04-09 21:18:28 +02:00
gboolean
2008-12-07 12:28:18 +01:00
query_misc_string_in_array(const gchar *string, const GPtrArray *array);
2005-04-04 12:36:04 +02:00
2005-04-13 15:01:59 +02:00
gboolean
query_misc_integer_is_in_g_array(gint item, GArray *array);
2005-05-18 18:00:49 +02:00
void
2005-10-24 22:50:48 +02:00
misc_string_replace_token(gchar *string, const gchar *token,
const gchar *replacement);
2005-05-18 18:00:49 +02:00
2005-06-21 15:33:16 +02:00
gfloat
misc_get_age_from_birth(gint birth_year, gint birth_month);
2005-06-28 04:08:56 +02:00
const gchar*
misc_skip_spaces(const gchar* s);
const gchar*
misc_parse_value(const gchar *s, gint *value);
const gchar*
2005-07-01 22:51:46 +02:00
misc_parse_expression(const gchar *s, gint *result);
2005-06-28 04:08:56 +02:00
const gchar*
2005-07-01 22:51:46 +02:00
misc_parse_comparison(const gchar *s, gint *result);
2005-06-28 04:08:56 +02:00
const gchar*
2005-07-01 22:51:46 +02:00
misc_parse_and(const gchar *s, gint *result);
2005-06-28 04:08:56 +02:00
const gchar*
2005-07-01 22:51:46 +02:00
misc_parse(const gchar *s, gint *result);
2005-06-28 04:08:56 +02:00
2005-08-16 14:49:45 +02:00
GPtrArray*
misc_copy_ptr_array(const GPtrArray *array);
2005-10-09 11:35:44 +02:00
void
misc_string_assign(gchar **string, const gchar *contents);
2005-10-24 22:50:48 +02:00
void
misc_string_choose_random(gchar *string);
void
misc_string_replace_expressions(gchar *string);
void
misc_string_replace_tokens(gchar *string, GPtrArray **token_rep);
gboolean
misc_parse_condition(const gchar *condition, GPtrArray **token_rep);
void
misc_token_add(GPtrArray **token_rep, gint token_idx,
gchar *replacement);
void
misc_token_remove(GPtrArray **token_rep, gint idx);
2005-10-27 23:10:15 +02:00
void
misc_string_get_parenthesised(const gchar *string, gchar *dest);
void
misc_string_replace_parenthesised(gchar *string, const gchar *paren,
const gchar *replacement);
2005-10-24 22:50:48 +02:00
2008-11-28 15:09:08 +01:00
gboolean
misc_string_replace_all_tokens(GPtrArray **token_rep,
const gchar *text_tokens, gchar *dest);
2008-12-03 22:46:27 +01:00
void
misc_token_add_bool(GPtrArray **token_rep, gint token_idx,
gboolean value);
2009-03-10 21:58:34 +01:00
gint
misc_alphabetic_compare(gconstpointer a, gconstpointer b);
GArray *
misc_parse_condition_fast(const gchar *condition);
gboolean
misc_evaluate_condition(const GArray *condition, GPtrArray **token_rep);
2004-12-23 13:58:39 +01:00
#endif