summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/config/config.h
blob: 133588641307e99d04cf9e9b544fd054bd9834d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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