30 lines
944 B
C++
30 lines
944 B
C++
#include "command.h"
|
|
|
|
namespace mshconsole{
|
|
void Command::Data::set(bool b){
|
|
if(isSDataValorized) throw MultipleDefinitionException();
|
|
b ? state=Data::TRUE : state=Data::FALSE;
|
|
isSDataValorized=true;
|
|
}
|
|
void Command::Data::set(const string& s){
|
|
if(isSDataValorized) throw MultipleDefinitionException();
|
|
state=Data::STRING;
|
|
sData=s;
|
|
isSDataValorized=true;
|
|
}
|
|
enum Command::Data::States Command::Data::getState() const{
|
|
return state;
|
|
}
|
|
const string& Command::Data::getData() const{
|
|
if(state!=Data::STRING) return EMPTY;
|
|
else return sData;
|
|
}
|
|
bool Command::Data::getBoolState() const{
|
|
return state!=Data::FALSE;
|
|
}
|
|
Command::Data* Command::Datas::getOptData(const string& opt) const{
|
|
for(size_t i=0; i<size(); i++){
|
|
if(operator[](i)->of->getOptionName()==opt) return operator[](i);
|
|
}
|
|
}
|
|
}
|