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; |
---|
7 | else if ( s == "generator" ) return generator; |
---|
8 | else if ( s == "test" ) return test; |
---|
9 | else if ( s == "madx" ) return madx; |
---|
10 | else if ( s == "usersprogram" ) return usersprogram; |
---|
11 | return unknownSoftware; |
---|
12 | } |
---|
13 | |
---|
14 | std::string nomDeLogiciel::toString(nomDeLogiciel::Logiciel lg) |
---|
15 | { |
---|
16 | switch (lg) |
---|
17 | { |
---|
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"; } |
---|
23 | case usersprogram : { return "usersprogram"; } |
---|
24 | case unknownSoftware : { return "unknownSoftware"; } |
---|
25 | } |
---|
26 | return "unknownSoftware"; |
---|
27 | } |
---|
28 | |
---|
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"; } |
---|
42 | } |
---|
43 | return "#FFFFFF"; |
---|
44 | } |
---|
45 | |
---|
46 | nomDeLogiciel::nomDeLogiciel() |
---|
47 | { |
---|
48 | program_ = unknownSoftware; |
---|
49 | progString_ = toString(program_); |
---|
50 | } |
---|
51 | |
---|
52 | nomDeLogiciel::nomDeLogiciel(const string& s) |
---|
53 | { |
---|
54 | program_ = fromString(s); |
---|
55 | progString_ = toString(program_); |
---|
56 | } |
---|
57 | |
---|
58 | nomDeLogiciel::nomDeLogiciel(int val) |
---|
59 | { |
---|
60 | program_ = (Logiciel)val; |
---|
61 | progString_ = toString(program_); |
---|
62 | } |
---|
63 | |
---|
64 | int nomDeLogiciel::getNumberOfSoftwares() |
---|
65 | { |
---|
66 | return unknownSoftware; |
---|
67 | } |
---|
68 | |
---|
69 | // operators |
---|
70 | nomDeLogiciel& nomDeLogiciel::operator= (const nomDeLogiciel& nl) |
---|
71 | { |
---|
72 | program_ = nl.program_; |
---|
73 | progString_ = nl.progString_; |
---|
74 | return *this; |
---|
75 | } |
---|
76 | |
---|
77 | bool nomDeLogiciel::operator== (const nomDeLogiciel& nl) |
---|
78 | { |
---|
79 | return ( program_ == nl.program_); |
---|
80 | } |
---|
81 | |
---|
82 | bool nomDeLogiciel::operator!= (const nomDeLogiciel& nl) |
---|
83 | { |
---|
84 | return ( program_ != nl.program_); |
---|
85 | } |
---|