aboutsummaryrefslogtreecommitdiff
path: root/src/functionunique.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-08 22:58:28 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-08 22:58:28 +0000
commit52be1ef0d126f09ba943c7afcf367e7d9347f2fd (patch)
treefd4b0dd148751c3c6c1b95296c3b82cb86051b83 /src/functionunique.cpp
parent795d0737fed40d88a7801b451b7750ba90802345 (diff)
downloadbuild-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.gz
build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.bz2
build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.xz
build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.zip
tabconv: it's all spaces now.
Diffstat (limited to '')
-rw-r--r--src/functionunique.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/functionunique.cpp b/src/functionunique.cpp
index ca2461f..f12712e 100644
--- a/src/functionunique.cpp
+++ b/src/functionunique.cpp
@@ -3,7 +3,7 @@
3#include <bu/hash.h> 3#include <bu/hash.h>
4#include <bu/plugger.h> 4#include <bu/plugger.h>
5PluginInterface3( pluginFunctionUnique, unique, FunctionUnique, Function, 5PluginInterface3( pluginFunctionUnique, unique, FunctionUnique, Function,
6 "Mike Buland", 0, 1 ); 6 "Mike Buland", 0, 1 );
7 7
8FunctionUnique::FunctionUnique() 8FunctionUnique::FunctionUnique()
9{ 9{
@@ -15,33 +15,33 @@ FunctionUnique::~FunctionUnique()
15 15
16Bu::String FunctionUnique::getName() const 16Bu::String FunctionUnique::getName() const
17{ 17{
18 return "unique"; 18 return "unique";
19} 19}
20 20
21Variable FunctionUnique::call( Variable &input, VarList lParams ) 21Variable FunctionUnique::call( Variable &input, VarList lParams )
22{ 22{
23 if( lParams.getSize() > 0 ) 23 if( lParams.getSize() > 0 )
24 throw Bu::ExceptionBase("Unique does not take any parameters."); 24 throw Bu::ExceptionBase("Unique does not take any parameters.");
25 if( input.getType() != Variable::typeList ) 25 if( input.getType() != Variable::typeList )
26 throw Bu::ExceptionBase("unique does not work on non-list types."); 26 throw Bu::ExceptionBase("unique does not work on non-list types.");
27 27
28 Bu::Hash<Bu::String, bool> hHas; 28 Bu::Hash<Bu::String, bool> hHas;
29 29
30 Variable vOut( Variable::typeList ); 30 Variable vOut( Variable::typeList );
31 for( VarList::iterator i = input.begin(); i; i++ ) 31 for( VarList::iterator i = input.begin(); i; i++ )
32 { 32 {
33 if( (*i).getType() != Variable::typeString ) 33 if( (*i).getType() != Variable::typeString )
34 continue; 34 continue;
35 35
36 Bu::String s = (*i).getString(); 36 Bu::String s = (*i).getString();
37 37
38 if( hHas.has( s ) ) 38 if( hHas.has( s ) )
39 continue; 39 continue;
40 40
41 hHas.insert( s, true ); 41 hHas.insert( s, true );
42 vOut.append( *i ); 42 vOut.append( *i );
43 } 43 }
44 44
45 return vOut; 45 return vOut;
46} 46}
47 47