20 lines
659 B
C++
20 lines
659 B
C++
|
#include "command.h"
|
||
|
|
||
|
namespace mshconsole {
|
||
|
Command::Data* Command::Datas::getOptData(const string& opt) const{
|
||
|
for(size_t i=0; i<this->size(); i++){
|
||
|
if(opt == this->at(i)->of->longName) return this->at(i);
|
||
|
}
|
||
|
}
|
||
|
Command::Data* Command::Datas::getOptData(char opt) const{
|
||
|
for(size_t i=0; i<this->size(); i++){
|
||
|
if(opt == this->at(i)->of->shortName) return this->at(i);
|
||
|
}
|
||
|
}
|
||
|
Command::Data* Command::Datas::operator [](const string& opt) const{
|
||
|
if(opt.length()>2) return getOptData(opt);
|
||
|
if(opt.length()==1) return getOptData(opt[0]);
|
||
|
else return nullptr;
|
||
|
}
|
||
|
}
|