From 52be1ef0d126f09ba943c7afcf367e7d9347f2fd Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 8 Nov 2012 22:58:28 +0000 Subject: tabconv: it's all spaces now. --- src/functionrange.cpp | 94 +++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'src/functionrange.cpp') diff --git a/src/functionrange.cpp b/src/functionrange.cpp index f45cf0e..e6267cf 100644 --- a/src/functionrange.cpp +++ b/src/functionrange.cpp @@ -2,7 +2,7 @@ #include PluginInterface3( pluginFunctionRange, range, FunctionRange, Function, - "Mike Buland", 0, 1 ); + "Mike Buland", 0, 1 ); FunctionRange::FunctionRange() { @@ -14,58 +14,58 @@ FunctionRange::~FunctionRange() Bu::String FunctionRange::getName() const { - return "range"; + return "range"; } Variable FunctionRange::call( Variable &input, VarList lParams ) { - Variable vRet( Variable::typeList ); - int iLow = 1; - int iHigh = 1; - int iStep = 1; - if( lParams.getSize() == 1 ) - { - iHigh = lParams.first().toInt(); - } - else if( lParams.getSize() == 2 ) - { - iLow = lParams.first().toInt(); - iHigh = lParams.last().toInt(); - } - else if( lParams.getSize() == 3 ) - { - VarList::iterator i = lParams.begin(); - iLow = (*i).toInt(); - i++; - iHigh = (*i).toInt(); - i++; - iStep = (*i).toInt(); - } - if( iStep == 0 ) - throw Bu::ExceptionBase("Step cannot be zero."); + Variable vRet( Variable::typeList ); + int iLow = 1; + int iHigh = 1; + int iStep = 1; + if( lParams.getSize() == 1 ) + { + iHigh = lParams.first().toInt(); + } + else if( lParams.getSize() == 2 ) + { + iLow = lParams.first().toInt(); + iHigh = lParams.last().toInt(); + } + else if( lParams.getSize() == 3 ) + { + VarList::iterator i = lParams.begin(); + iLow = (*i).toInt(); + i++; + iHigh = (*i).toInt(); + i++; + iStep = (*i).toInt(); + } + if( iStep == 0 ) + throw Bu::ExceptionBase("Step cannot be zero."); - if( iHigh < iLow ) - { - if( iStep > 0 ) - throw Bu::ExceptionBase( - "If start is less than end then step must be negative."); - for( int j = iLow; j >= iHigh; j += iStep ) - { - vRet.append( Variable( j ) ); - } - } - else - { - if( iStep < 0 ) - throw Bu::ExceptionBase( - "If start is more than end then step must be positive."); - for( int j = iLow; j <= iHigh; j += iStep ) - { - vRet.append( Variable( j ) ); - } - } + if( iHigh < iLow ) + { + if( iStep > 0 ) + throw Bu::ExceptionBase( + "If start is less than end then step must be negative."); + for( int j = iLow; j >= iHigh; j += iStep ) + { + vRet.append( Variable( j ) ); + } + } + else + { + if( iStep < 0 ) + throw Bu::ExceptionBase( + "If start is more than end then step must be positive."); + for( int j = iLow; j <= iHigh; j += iStep ) + { + vRet.append( Variable( j ) ); + } + } - return vRet; + return vRet; } -- cgit v1.2.3