Condition::Condition(SourcePackage &p, const string &expr):
pkg(p)
{
- vector<string> parts=split(expr);
+ vector<string> parts = split(expr);
for(vector<string>::iterator i=parts.begin(); i!=parts.end(); ++i)
{
if(*i=="and")
continue;
- string::size_type token=i->find_first_of("=!");
+ string::size_type token = i->find_first_of("=!");
if(token==string::npos)
expression.insert(StringMap::value_type(*i, "!0"));
else if(token==0 && (*i)[0]=='!')
bool Condition::eval()
{
- const Config &conf=pkg.get_config();
+ const Config &conf = pkg.get_config();
- bool result=true;
+ bool result = true;
for(StringMap::iterator i=expression.begin(); i!=expression.end(); ++i)
{
- bool neg=(i->second[0]=='!');
- unsigned start=1;
+ bool neg = (i->second[0]=='!');
+ unsigned start = 1;
if(i->second[1]=='=')
++start;
string value;
if(conf.is_option(i->first))
- value=conf.get_option(i->first).value;
+ value = conf.get_option(i->first).value;
else if(i->first=="arch")
- value=pkg.get_builder().get_current_arch().get_name();
+ value = pkg.get_builder().get_current_arch().get_name();
if((value==i->second.substr(start))==neg)
- result=false;
+ result = false;
}
return result;