/******************************************
*
* Cedric Pradalier 2001
* mail : http://cedric.pradalier.free.fr/mail.html
*
*****************************************/
#ifndef HORAIRE_H
#define HORAIRE_H
#include "objet.h"
class CHoraire;
/* classe definissant des heures :
plus bas l'objet HNULL : horaire invalide
et l'objet HGEN : horaire generic */
class CHoraire : public CObjet
{
public:
int heure;
int minute;
CHoraire() {heure = minute = 99;}
virtual ~CHoraire() {}
// constructeur de copie
CHoraire(const CHoraire & hr) {heure = hr.heure;minute = hr.minute;}
CHoraire(int h,int m) {heure = h;minute = m;}
// constructeur de conversion a partir d'un entier HHMM
CHoraire(int hm) {heure = hm / 100; minute = hm % 100;}
// Test de validite
int IsValide();
// Test de genericite : == 88:88
int IsGeneric();
// Operateurs de comparaison
int operator<=(CHoraire h2);
int operator!=(CHoraire h2);
bool operator>(CHoraire h2);
// Operateur arithmetiques
CHoraire operator+(CHoraire h2);
CHoraire operator-(CHoraire h2);
CHoraire operator*(int lambda);
CHoraire operator/(int lambda);
// Interpolation lineraire entre this et h2
// Res = h1 + (h2-h1)*mult/div
CHoraire Interpol(CHoraire h2,int mult,int div);
// fonction virtuelle standard d'affichage :
virtual void Print();
};
const CHoraire HNULL(99,99);
const CHoraire HGEN(88,88);
#endif // HORAIRES_H