2005-10-20 17:45:00 +02:00
|
|
|
/*
|
2005-11-26 17:52:51 +01:00
|
|
|
xml.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.
|
|
|
|
*/
|
|
|
|
|
2005-04-06 00:14:39 +02:00
|
|
|
#ifndef XML_H
|
|
|
|
#define XML_H
|
|
|
|
|
|
|
|
#include "bygfoot.h"
|
|
|
|
#include "maths.h"
|
2005-08-20 21:39:36 +02:00
|
|
|
#include "cup_struct.h"
|
2005-04-06 00:14:39 +02:00
|
|
|
|
|
|
|
/** Indentations for xml files. */
|
|
|
|
#define I0 ""
|
|
|
|
#define I1 "\t"
|
|
|
|
#define I2 "\t\t"
|
|
|
|
#define I3 "\t\t\t"
|
|
|
|
#define I4 "\t\t\t\t"
|
|
|
|
#define I5 "\t\t\t\t\t"
|
|
|
|
#define I6 "\t\t\t\t\t\t"
|
|
|
|
#define I7 "\t\t\t\t\t\t\t"
|
|
|
|
#define I8 "\t\t\t\t\t\t\t\t"
|
|
|
|
|
|
|
|
/** Tags that are used in more than one type of xml file. */
|
|
|
|
enum XmlTags
|
|
|
|
{
|
|
|
|
TAG_NAME = 0,
|
|
|
|
TAG_SYMBOL,
|
|
|
|
TAG_SID,
|
|
|
|
TAG_SHORT_NAME,
|
|
|
|
TAG_ID,
|
|
|
|
TAG_WEEK_GAP,
|
|
|
|
TAG_YELLOW_RED,
|
|
|
|
TAG_TEAM_ID,
|
2005-06-01 20:19:02 +02:00
|
|
|
TAG_NAMES_FILE,
|
2005-04-06 00:14:39 +02:00
|
|
|
TAG_ROUND
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Starting values for tag enums in the various xml loading source files. */
|
|
|
|
#define TAG_START_MISC 1000
|
|
|
|
#define TAG_START_LEAGUE 2000
|
|
|
|
#define TAG_START_CUP 3000
|
|
|
|
#define TAG_START_TEAMS 4000
|
|
|
|
#define TAG_START_FIXTURES 5000
|
|
|
|
#define TAG_START_TABLE 6000
|
|
|
|
#define TAG_START_USERS 7000
|
|
|
|
#define TAG_START_LIVE_GAME 8000
|
2005-07-08 19:34:10 +02:00
|
|
|
#define TAG_START_PLAYERS 9000
|
|
|
|
#define TAG_END_PLAYERS 9900
|
2005-04-30 15:57:58 +02:00
|
|
|
#define TAG_START_LEAGUE_STAT 10000
|
2005-05-02 16:39:30 +02:00
|
|
|
#define TAG_START_SEASON_STATS 11000
|
2005-10-21 15:45:58 +02:00
|
|
|
#define TAG_START_LEAGUES_CUPS 12000
|
2005-07-08 19:34:10 +02:00
|
|
|
#define TAG_START_TRANSFERS 20000
|
2005-12-01 12:50:54 +01:00
|
|
|
#define TAG_START_JOBS 21000
|
2005-04-06 00:14:39 +02:00
|
|
|
|
|
|
|
#define xml_write_g_string(fil, gstring, tag, indent) xml_write_string(fil, (gstring)->str, tag, indent)
|
|
|
|
|
|
|
|
#define xml_write_int(fil, value, tag, indent) fprintf(fil, "%s<_%d>%d</_%d>\n", indent, tag, value, tag)
|
|
|
|
|
|
|
|
#define xml_write_float(fil, value, tag, indent) fprintf(fil, "%s<_%d>%d</_%d>\n", indent, tag, (gint)rint(value * 10000), tag)
|
|
|
|
|
2005-06-28 04:08:56 +02:00
|
|
|
#define xml_get_tag_from_name(name) (gint)g_ascii_strtod(name + 1, NULL)
|
|
|
|
|
2005-10-15 18:49:04 +02:00
|
|
|
void
|
|
|
|
xml_write_string(FILE *fil, const gchar *string, gint tag, const gchar* indent);
|
|
|
|
|
2005-04-06 00:14:39 +02:00
|
|
|
void
|
|
|
|
xml_load_users(const gchar *dirname, const gchar *basename);
|
|
|
|
|
|
|
|
void
|
2005-10-21 15:45:58 +02:00
|
|
|
xml_load_league(const gchar *dirname, const gchar *basename);
|
2005-04-06 00:14:39 +02:00
|
|
|
|
|
|
|
void
|
2005-10-21 15:45:58 +02:00
|
|
|
xml_load_cup(Cup *cup, const gchar *dirname, const gchar *basename);
|
2005-04-06 00:14:39 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
xml_load_transfers(const gchar *dirname, const gchar *basename);
|
|
|
|
|
|
|
|
#endif
|