X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcondition.cpp;h=314d9c93688c592f80d9c07452cedb2c31be8cb7;hb=04c316da6d5d90e43cba262f54d90ca231f703bf;hp=5cce44462d3e984b9f61e85f2152e9c994a70d07;hpb=0f5283a54fd188072eca23fbd980a43c6c869913;p=builder.git diff --git a/source/condition.cpp b/source/condition.cpp index 5cce444..314d9c9 100644 --- a/source/condition.cpp +++ b/source/condition.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of builder -Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions +Copyright © 2007-2009 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ @@ -16,14 +16,14 @@ using namespace Msp; Condition::Condition(SourcePackage &p, const string &expr): pkg(p) { - vector parts=split(expr); + vector parts = split(expr); for(vector::iterator i=parts.begin(); i!=parts.end(); ++i) { if(*i=="and") continue; - unsigned 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]=='!') @@ -35,24 +35,24 @@ Condition::Condition(SourcePackage &p, const string &expr): 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;