From 3c7e81d3baba06cb1bf37de84aeaa6cad277652a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 6 Jan 2010 17:05:45 +0000 Subject: Wow, ok, well, I added some more error handling, that's positive, also switched conditions and functions to a plugger system like views, and all of them now load builtin and external plugins flawlessly. It's actually a lot of fun. I also added the example/test plugin condition "random" it randomly builds targets...it's not really useful... --- src/profile.cpp | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'src/profile.cpp') diff --git a/src/profile.cpp b/src/profile.cpp index 878a6e9..fd21097 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -4,9 +4,7 @@ #include "astleaf.h" #include "condition.h" -#include "conditionfiletime.h" -#include "conditionalways.h" -#include "conditionnever.h" +#include "conditionplugger.h" #include using namespace Bu; @@ -64,7 +62,7 @@ Profile *Profile::genDefaultClean() pAst->openBranch(); pAst->addNode( AstNode::typeString, "clean" ); pAst->openBranch(); - pAst->addNode( AstNode::typeCondition, "always" ); + pAst->addNode( AstNode::typeCondition, "fileExists" ); pAst->addNode( AstNode::typeFunction ); pAst->openBranch(); pAst->addNode( AstNode::typeString, "unlink" ); @@ -89,28 +87,15 @@ void Profile::setCondition() if( (*i)->getType() == AstNode::typeCondition ) { Bu::FString sCond = dynamic_cast(*i)->getStrValue(); - if( sCond == "filetime" ) - { - delete pCond; - pCond = new ConditionFileTime(); - } - else if( sCond == "always" ) - { - delete pCond; - pCond = new ConditionAlways(); - } - else if( sCond == "never" ) - { - delete pCond; - pCond = new ConditionNever(); - } + delete pCond; + pCond = ConditionPlugger::getInstance().instantiate( sCond ); } } if( pCond == NULL ) { // The default condition - pCond = new ConditionFileTime(); + pCond = ConditionPlugger::getInstance().instantiate("fileTime"); } } -- cgit v1.2.3