[160] | 1 | #include "nomDeLogiciel.h" |
---|
| 2 | |
---|
| 3 | nomDeLogiciel::Logiciel nomDeLogiciel::fromString( std::string s) |
---|
| 4 | { |
---|
| 5 | if (s == "parmela" ) return parmela; |
---|
| 6 | else if ( s == "transport" ) return transport; |
---|
[304] | 7 | else if ( s == "generator" ) return generator; |
---|
[316] | 8 | else if ( s == "test" ) return test; |
---|
[431] | 9 | else if ( s == "madx" ) return madx; |
---|
[442] | 10 | else if ( s == "usersprogram" ) return usersprogram; |
---|
[160] | 11 | return unknownSoftware; |
---|
| 12 | } |
---|
| 13 | |
---|
[431] | 14 | std::string nomDeLogiciel::toString(nomDeLogiciel::Logiciel lg) |
---|
| 15 | { |
---|
| 16 | switch (lg) |
---|
[160] | 17 | { |
---|
[431] | 18 | case parmela : { return "parmela"; } |
---|
| 19 | case transport : { return "transport"; } |
---|
| 20 | case generator : { return "generator"; } |
---|
| 21 | case test : { return "test"; } |
---|
| 22 | case madx : { return "madx"; } |
---|
[442] | 23 | case usersprogram : { return "usersprogram"; } |
---|
[431] | 24 | case unknownSoftware : { return "unknownSoftware"; } |
---|
[160] | 25 | } |
---|
[431] | 26 | return "unknownSoftware"; |
---|
| 27 | } |
---|
[160] | 28 | |
---|
[431] | 29 | /** Color of the background of the sofware |
---|
| 30 | Should be a valid Css name as FFEEDD |
---|
| 31 | */ |
---|
| 32 | std::string nomDeLogiciel::getWtColor( nomDeLogiciel::Logiciel lg) const |
---|
| 33 | { |
---|
| 34 | switch (lg) |
---|
| 35 | { |
---|
| 36 | case parmela : { return "#e09bdf"; } |
---|
| 37 | case transport : { return "#c0ea8e"; } |
---|
| 38 | case generator : { return "#a3c0ed"; } |
---|
| 39 | case test : { return "#ecc38e"; } |
---|
| 40 | case madx : { return "#ecc38e"; } //{ return "#FFFF00"; } |
---|
| 41 | case unknownSoftware : { return "#FFFFFF"; } |
---|
[160] | 42 | } |
---|
[431] | 43 | return "#FFFFFF"; |
---|
| 44 | } |
---|
[160] | 45 | |
---|
[431] | 46 | nomDeLogiciel::nomDeLogiciel() |
---|
| 47 | { |
---|
| 48 | program_ = unknownSoftware; |
---|
| 49 | progString_ = toString(program_); |
---|
| 50 | } |
---|
[316] | 51 | |
---|
[431] | 52 | nomDeLogiciel::nomDeLogiciel(const string& s) |
---|
| 53 | { |
---|
| 54 | program_ = fromString(s); |
---|
| 55 | progString_ = toString(program_); |
---|
| 56 | } |
---|
[316] | 57 | |
---|
[431] | 58 | nomDeLogiciel::nomDeLogiciel(int val) |
---|
| 59 | { |
---|
| 60 | program_ = (Logiciel)val; |
---|
| 61 | progString_ = toString(program_); |
---|
| 62 | } |
---|
| 63 | |
---|
[160] | 64 | int nomDeLogiciel::getNumberOfSoftwares() |
---|
| 65 | { |
---|
[316] | 66 | return unknownSoftware; |
---|
[160] | 67 | } |
---|
| 68 | |
---|
[431] | 69 | // operators |
---|
| 70 | nomDeLogiciel& nomDeLogiciel::operator= (const nomDeLogiciel& nl) |
---|
| 71 | { |
---|
| 72 | program_ = nl.program_; |
---|
| 73 | progString_ = nl.progString_; |
---|
| 74 | return *this; |
---|
| 75 | } |
---|
[160] | 76 | |
---|
[431] | 77 | bool nomDeLogiciel::operator== (const nomDeLogiciel& nl) |
---|
| 78 | { |
---|
| 79 | return ( program_ == nl.program_); |
---|
| 80 | } |
---|
[160] | 81 | |
---|
[431] | 82 | bool nomDeLogiciel::operator!= (const nomDeLogiciel& nl) |
---|
| 83 | { |
---|
| 84 | return ( program_ != nl.program_); |
---|
| 85 | } |
---|