summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/config/config.h
diff options
context:
space:
mode:
Diffstat (limited to '2003/i/buzz/src/config/config.h')
-rw-r--r--2003/i/buzz/src/config/config.h34
1 files changed, 34 insertions, 0 deletions
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