Changeset 160 in PSPA for Interface_Web/trunk/pspaWT/include
- Timestamp:
- Dec 9, 2012, 1:50:14 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/include/nomDeLogiciel.h
r107 r160 4 4 #include <string> 5 5 6 using namespace std; 6 7 7 8 class nomDeLogiciel … … 23 24 int value_; 24 25 25 static Logiciel fromString( std::string s) 26 { 27 if (s == "parmela" ) return parmela; 28 else if ( s == "transport" ) return transport; 29 return unknownSoftware; 30 } 31 32 static std::string toString( Logiciel lg) 33 { 34 switch (lg) 35 { 36 case parmela : { return "parmela"; } 37 case transport : { return "transport"; } 38 case unknownSoftware : { return "unknownSoftware"; } 39 } 40 return "unknownSoftware"; 41 } 42 43 static Logiciel fromValue( int v) 44 { 45 switch (v) 46 { 47 case 0 : { return parmela; } 48 case 1 : { return transport; } 49 } 50 return unknownSoftware; 51 } 52 53 static int toValue( Logiciel lg) 54 { 55 switch (lg) 56 { 57 case parmela : { return 0; } 58 case transport : { return 1; } 59 case unknownSoftware : { return 2; } 60 } 61 return -1; 62 } 26 static Logiciel fromString( std::string s); 27 static std::string toString( Logiciel lg); 28 static Logiciel fromValue( int v); 29 static int toValue( Logiciel lg); 63 30 64 31 public : 65 32 // constructors 66 33 67 nomDeLogiciel() : program_(transport) 68 { 69 progString_ = toString(program_); 70 value_ = toValue(program_); 71 } 34 nomDeLogiciel(); 35 nomDeLogiciel(const string& s); 36 nomDeLogiciel(int val); 72 37 73 74 nomDeLogiciel(const string& s) 75 { 76 program_ = fromString(s); 77 progString_ = toString(program_); 78 value_ = toValue(program_); 79 } 80 81 nomDeLogiciel(int val) 82 { 83 program_ = fromValue(val); 84 progString_ = toString(program_); 85 value_ = toValue(program_); 86 } 87 88 static int getNumberOfSoftwares() { return toValue(unknownSoftware);} 38 static int getNumberOfSoftwares(); 89 39 90 40 inline std::string getString() const {return progString_;} … … 92 42 // operators 93 43 94 nomDeLogiciel& operator= (const nomDeLogiciel& nl) 95 { 96 program_ = nl.program_; 97 progString_ = nl.progString_; 98 value_ = nl.value_; 99 return *this; 100 } 101 102 bool operator== (const nomDeLogiciel& nl) 103 { 104 return ( program_ == nl.program_); 105 } 106 107 bool operator!= (const nomDeLogiciel& nl) 108 { 109 return ( program_ != nl.program_); 110 } 44 nomDeLogiciel& operator= (const nomDeLogiciel& nl); 45 bool operator== (const nomDeLogiciel& nl); 46 bool operator!= (const nomDeLogiciel& nl); 111 47 112 48 }; -
Interface_Web/trunk/pspaWT/include/nomdElements.h
r153 r160 6 6 enum typedElement {RFgun, drift, cell, bend, soleno, inconnu}; 7 7 8 9 8 10 class nomdElements 9 11 { 10 typedElement e_; 11 std::string eStr_; 12 std::string eImg_; 12 typedElement e_; // type entier (enum) 13 std::string eName_; // nom de l'element 14 std::string eImg_; // nom du fichier de l'icone 15 std::string eLabel_; // label affiche sous l'icone 13 16 14 typedElement fromString(std::string s); 15 std::string toString(typedElement eType); 16 std::string toImage(typedElement eType); 17 18 static typedElement fromImage(std::string s); 19 static std::string toName(typedElement eType); 20 static std::string toImage(typedElement eType); 21 static std::string toLabel(typedElement eType); 17 22 18 23 public : … … 26 31 27 32 static int getNumberOfElements(); 33 static string getImageFromType( typedElement tp); 34 static std::string getLabelFromType(typedElement tp); 35 28 36 typedElement getElementType() const; 29 37 std::string getElementName() const;
Note: See TracChangeset
for help on using the changeset viewer.