#include "nomDeLogiciel.h" nomDeLogiciel::Logiciel nomDeLogiciel::fromString( std::string s) { if (s == "parmela" ) return parmela; else if ( s == "transport" ) return transport; return unknownSoftware; } std::string nomDeLogiciel::toString( nomDeLogiciel::Logiciel lg) { switch (lg) { case parmela : { return "parmela"; } case transport : { return "transport"; } case unknownSoftware : { return "unknownSoftware"; } } return "unknownSoftware"; } nomDeLogiciel::Logiciel nomDeLogiciel::fromValue( int v) { switch (v) { case 0 : { return parmela; } case 1 : { return transport; } } return unknownSoftware; } int nomDeLogiciel::toValue( nomDeLogiciel::Logiciel lg) { switch (lg) { case parmela : { return 0; } case transport : { return 1; } case unknownSoftware : { return 2; } } return -1; } nomDeLogiciel::nomDeLogiciel() { program_ = transport; progString_ = toString(program_); value_ = toValue(program_); } nomDeLogiciel::nomDeLogiciel(const string& s) { program_ = fromString(s); progString_ = toString(program_); value_ = toValue(program_); } nomDeLogiciel::nomDeLogiciel(int val) { program_ = fromValue(val); progString_ = toString(program_); value_ = toValue(program_); } int nomDeLogiciel::getNumberOfSoftwares() { return toValue(unknownSoftware); } // operators nomDeLogiciel& nomDeLogiciel::operator= (const nomDeLogiciel& nl) { program_ = nl.program_; progString_ = nl.progString_; value_ = nl.value_; return *this; } bool nomDeLogiciel::operator== (const nomDeLogiciel& nl) { return ( program_ == nl.program_); } bool nomDeLogiciel::operator!= (const nomDeLogiciel& nl) { return ( program_ != nl.program_); }