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

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

definition des compatibilites des elements dans les software

File size: 2.3 KB
Line 
1#include "nomDeLogiciel.h"
2
3
4nomDeLogiciel::Logiciel nomDeLogiciel::fromString( std::string s)
5  {
6    if (s == "parmela" ) return parmela;
7    else if ( s == "transport" ) return transport;
8    else if ( s == "generator" ) return generator;
9    else if ( s == "useraction" ) return useraction;
10    else if ( s == "test" ) return test;
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 useraction : { return "useraction"; }
22      case test : { return "test"; }
23      case unknownSoftware : { return "unknownSoftware"; }
24      }
25    return "unknownSoftware";
26  }
27
28    /** Color of the background of the sofware
29     Should be a valid Css name as FFEEDD
30     */
31 std::string nomDeLogiciel::getWtColor( nomDeLogiciel::Logiciel lg) const
32  {
33    switch (lg)
34      {
35      case parmela : { return "#e09bdf"; }
36      case transport : { return "#c0ea8e"; }
37      case generator : { return "#a3c0ed"; }
38      case useraction : { return "#FFFFFF"; }
39      case test : { return "#ecc38e"; }
40      case unknownSoftware : { return "#FFFFFF"; }
41      }
42    return "#FFFFFF";
43  }
44
45
46 nomDeLogiciel::nomDeLogiciel() 
47  {
48    program_ = unknownSoftware;
49    progString_ = toString(program_);
50    //    value_ = toValue(program_);
51  }
52
53  nomDeLogiciel::nomDeLogiciel(const string& s)
54    {
55      program_ = fromString(s);
56      progString_ = toString(program_);
57      //      value_ = toValue(program_);
58    }
59
60  nomDeLogiciel::nomDeLogiciel(int val)
61    { 
62      program_ = (Logiciel)val;
63      progString_ = toString(program_);
64      //      program_ = fromValue(val);
65      //      value_ = toValue(program_);
66    }
67
68
69
70int nomDeLogiciel::getNumberOfSoftwares() 
71{ 
72  //  return toValue(unknownSoftware);
73  return unknownSoftware;
74}
75
76  // operators
77 
78  nomDeLogiciel& nomDeLogiciel::operator= (const nomDeLogiciel& nl)
79    {
80      program_ = nl.program_;
81      progString_ = nl.progString_;
82      //      value_ = nl.value_;
83      return *this;
84    }
85
86  bool nomDeLogiciel::operator== (const nomDeLogiciel& nl)
87  {
88    return ( program_ == nl.program_);
89  }
90
91  bool nomDeLogiciel::operator!= (const nomDeLogiciel& nl)
92  {
93    return ( program_ != nl.program_);
94  }
Note: See TracBrowser for help on using the repository browser.