00001
00002
00009
00010
#ifndef XML_SCORE_H
00011
#define XML_SCORE_H
00012
00013
#include "../lib/libxml2/include/tree.h"
00014
#include "../lib/libxml2/include/xmlmemory.h"
00015
#include "../lib/libxml2/include/parser.h"
00016
00017
#include <string>
00018
#include <list>
00019
#include <set>
00020
00021 #define FICHIER_XML_SCORE "./data/score.xml"
00022
00024 typedef struct
00025
{
00026 std::string m_szNom;
00027 unsigned int m_uiScore;
00028 unsigned int m_uiNiveau;
00029 }
SJoueur;
00030
00032 typedef struct
00033
{
00034 std::list<SJoueur> m_Joueur;
00035 }
SScore;
00036
00037
inline bool operator < (
SScore Score1,
SScore Score2);
00038
inline bool operator > (
SScore Score1,
SScore Score2);
00039
00041 class CXMLScore
00042 {
00043
private:
00044 std::string m_szFilename;
00045 std::multiset<SScore, std::greater<SScore> > m_Scores;
00046 xmlDoc* m_pDocument;
00047
00049
void Scores (xmlNode* pScores);
00051
SScore Score (xmlNode* pElementScore);
00053
SJoueur Joueur (xmlNode* pElementJoueur);
00054
00055
public:
00056
CXMLScore ();
00057
~CXMLScore ();
00058
00060
bool Charger (
const char* szFilename);
00062
bool Sauver ();
00064
bool AjouterScore (
SScore Score);
00066 const std::multiset<SScore, std::greater<SScore> > &
GetListeScores ()
const {
return m_Scores;}
00067 };
00068
00069
#endif //XML_SCORE_H