X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuildinfo.cpp;h=2b4876fbda871c38d6281a49497539f2b7d54236;hb=921fc49488a68442fb8794e1a0284a3bf1e7b91b;hp=340fd9660bbdfd6333d9eb219df6389ff545108f;hpb=683301f94f4a3c5b7e2a7f21087f4185b07c4858;p=builder.git diff --git a/source/buildinfo.cpp b/source/buildinfo.cpp index 340fd96..2b4876f 100644 --- a/source/buildinfo.cpp +++ b/source/buildinfo.cpp @@ -1,8 +1,10 @@ -#include #include "buildinfo.h" using namespace Msp; +/** +Adds another BuildInfo to the end of this one. +*/ void BuildInfo::add(const BuildInfo &bi) { cflags.insert(cflags.end(), bi.cflags.begin(), bi.cflags.end()); @@ -13,6 +15,9 @@ void BuildInfo::add(const BuildInfo &bi) libs.insert(libs.end(), bi.libs.begin(), bi.libs.end()); } +/** +Makes sure there are no duplicate entries in the lists. +*/ void BuildInfo::unique() { unique(cflags); @@ -23,11 +28,15 @@ void BuildInfo::unique() unique(libs); } -void BuildInfo::unique(InfoList &l) +/** +Removes any duplicate entries from a list, leaving only the first one. The +order of other elements is preserved. O(n²) efficiency. +*/ +void BuildInfo::unique(StringList &l) { - InfoList l2; - for(InfoList::iterator i=l.begin(); i!=l.end(); ++i) - if(!contains(l2, *i)) + StringList l2; + for(StringList::iterator i=l.begin(); i!=l.end(); ++i) + if(find(l2.begin(), l2.end(), *i)==l2.end()) l2.push_back(*i); swap(l, l2); }