From 1f76a63936157c455356760b6288dbe8e4a10579 Mon Sep 17 00:00:00 2001 From: schodet Date: Mon, 26 May 2003 08:58:16 +0000 Subject: Ajout de config --- 2003/i/buzz/src/config/config.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 2003/i/buzz/src/config/config.h (limited to '2003/i/buzz/src/config/config.h') diff --git a/2003/i/buzz/src/config/config.h b/2003/i/buzz/src/config/config.h new file mode 100644 index 0000000..1335886 --- /dev/null +++ b/2003/i/buzz/src/config/config.h @@ -0,0 +1,34 @@ +#ifndef config_h +#define config_h +// config.h +// buzz - Programme du robot Efrei Robotique I1-I2 2003 +// Copyright (C) 2003 Nicolas Schodet + +class Config +{ + const char *m_filename; + int m_type; + public: + // Constructeur. + Config (const char *filename); + // Destructeur. + ~Config (void); + // Attend un token, sinon, jette une exception. + int getNum (void); + Config &operator>> (int &num) { num = getNum (); return *this; } + const char *getId (void); + Config &operator>> (const char *&s) { s = getId (); return *this; } + bool getBool (void); + Config &operator>> (bool &b) { b = getBool (); return *this; } + double getFloat (void); + Config &operator>> (double &fl) { fl = getFloat (); return *this; } + void getEof (void); + // Vérifie si le prochain token est... + bool isId (const char *s); + // Retourne true si ŕ la fin du fichier. + bool eof (void); + // Lance une erreur, on a pas trouvé ce qu'on voulais. + void noId (void); +}; + +#endif // config_h -- cgit v1.2.3