Debian Codegraph @

src/couleur.h

raw
1 /***************************************************************************
2 couleur.h - description
3 -------------------
4 begin : Mon Jun 4 2001
5 copyright : (C) 2001 by Olivier Langella
6 email : [email protected]
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 #ifndef COULEUR_H
19 #define COULEUR_H
20
21
22 /**stockage de couleur (RGB ou nom en Anglais)
23 *@author Olivier Langella
24 */
25 #include "vecteurs.h"
26
27 //typedef biolib::vecteurs::ChaineCar ChaineCar;
28
29 class Couleur {
30 public:
31
32 static const string & get_couleur_diff();
33
34 Couleur(const biolib::vecteurs::ChaineCar & couleur);
35 Couleur(unsigned long rouge, unsigned long vert, unsigned long bleu);
36 ~Couleur();
37
38 // void set_rgb(unsigned long rouge, unsigned long vert, unsigned long bleu);
39
40 bool EstNom() const {return(_boolnom);};
41 bool EstRGB() const {return(_boolrgb);};
42
43 void set_nom(const char * nom) {_boolrgb = false; _boolnom = true; _nom.assign(nom);};
44 const string & get_nom() const {return(_nom);};
45 unsigned long get_rouge() const {return(_rouge);};
46 unsigned long get_vert() const {return(_vert);};
47 unsigned long get_bleu() const {return(_bleu);};
48
49
50 bool operator== (const Couleur &rval) const;
51
52 protected:
53
54 static void f_rempli_tab_couleurs();
55
56 static vector<string> _tab_couleurs;
57 static unsigned int _pos_tab_couleurs;
58
59 bool _boolrgb;
60 bool _boolnom;
61
62 string _nom;
63
64 unsigned long _rouge;
65 unsigned long _vert;
66 unsigned long _bleu;
67
68
69 };
70
71 //unsigned int Couleur::_pos_tab_couleurs = 0;
72 /*
73 inline const string & Couleur::get_couleur_diff() {
74 unsigned int i;
75
76 if ( Couleur::_tab_couleurs.size() == 0 ) Couleur::f_rempli_tab_couleurs();
77 i = Couleur::_pos_tab_couleurs;
78 Couleur::_pos_tab_couleurs++;
79 if (Couleur::_pos_tab_couleurs == Couleur::_tab_couleurs.size()) Couleur::_pos_tab_couleurs = 0;
80
81 return (Couleur::_tab_couleurs[i]);
82 }
83 */
84 /*
85 inline void Couleur::f_rempli_tab_couleurs() {
86 _pos_tab_couleurs = 0;
87
88 _tab_couleurs.push_back("red");
89 _tab_couleurs.push_back("green");
90 _tab_couleurs.push_back("blue");
91
92 }
93 */
94 #endif
95
96