diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-08 22:58:28 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-08 22:58:28 +0000 |
commit | 52be1ef0d126f09ba943c7afcf367e7d9347f2fd (patch) | |
tree | fd4b0dd148751c3c6c1b95296c3b82cb86051b83 /src/functionunique.cpp | |
parent | 795d0737fed40d88a7801b451b7750ba90802345 (diff) | |
download | build-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.cpp | 40 |
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> |
5 | PluginInterface3( pluginFunctionUnique, unique, FunctionUnique, Function, | 5 | PluginInterface3( pluginFunctionUnique, unique, FunctionUnique, Function, |
6 | "Mike Buland", 0, 1 ); | 6 | "Mike Buland", 0, 1 ); |
7 | 7 | ||
8 | FunctionUnique::FunctionUnique() | 8 | FunctionUnique::FunctionUnique() |
9 | { | 9 | { |
@@ -15,33 +15,33 @@ FunctionUnique::~FunctionUnique() | |||
15 | 15 | ||
16 | Bu::String FunctionUnique::getName() const | 16 | Bu::String FunctionUnique::getName() const |
17 | { | 17 | { |
18 | return "unique"; | 18 | return "unique"; |
19 | } | 19 | } |
20 | 20 | ||
21 | Variable FunctionUnique::call( Variable &input, VarList lParams ) | 21 | Variable 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 | ||