source: PSPA/Interface_Web/trunk/pspaWT/sources/controler/src/nomDeLogiciel.cc @ 442

Last change on this file since 442 was 442, checked in by lemeur, 11 years ago

ajout traitement utilisateur

File size: 2.0 KB
Line 
1#include "nomDeLogiciel.h"
2
3nomDeLogiciel::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
14std::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*/
32std::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
52nomDeLogiciel::nomDeLogiciel(const string& s)
53{
54  program_ = fromString(s);
55  progString_ = toString(program_);
56}
57
58nomDeLogiciel::nomDeLogiciel(int val)
59{ 
60  program_ = (Logiciel)val;
61  progString_ = toString(program_);
62}
63
64int nomDeLogiciel::getNumberOfSoftwares() 
65{ 
66  return unknownSoftware;
67}
68
69// operators
70nomDeLogiciel& nomDeLogiciel::operator= (const nomDeLogiciel& nl)
71{
72  program_ = nl.program_;
73  progString_ = nl.progString_;
74  return *this;
75}
76
77bool nomDeLogiciel::operator== (const nomDeLogiciel& nl)
78{
79  return ( program_ == nl.program_);
80}
81
82bool nomDeLogiciel::operator!= (const nomDeLogiciel& nl)
83{
84  return ( program_ != nl.program_);
85}
Note: See TracBrowser for help on using the repository browser.