3 This file is part of builder
4 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
15 Adds another BuildInfo to the end of this one.
17 void BuildInfo::add(const BuildInfo &bi)
19 cflags.insert(cflags.end(), bi.cflags.begin(), bi.cflags.end());
20 defines.insert(defines.end(), bi.defines.begin(), bi.defines.end());
21 incpath.insert(incpath.end(), bi.incpath.begin(), bi.incpath.end());
22 ldflags.insert(ldflags.end(), bi.ldflags.begin(), bi.ldflags.end());
23 libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end());
24 libs.insert(libs.end(), bi.libs.begin(), bi.libs.end());
25 warnings.insert(warnings.end(), bi.warnings.begin(), bi.warnings.end());
29 Makes sure there are no duplicate entries in the lists.
31 void BuildInfo::unique()
40 for(StringList::iterator i=warnings.begin(); i!=warnings.end(); ++i)
42 bool flag=i->compare(0, 3, "no-");
44 string warn=(flag ? *i : i->substr(3));
45 string no_warn="no-"+warn;
47 for(StringList::iterator j=i; j!=warnings.end();)
49 if(j!=i && (*j==warn || *j==no_warn))
58 *i=(flag ? warn : no_warn);
63 Removes any duplicate entries from a list, leaving only the first one. The
64 order of other elements is preserved. O(n²) efficiency.
66 void BuildInfo::unique(StringList &l)
68 for(StringList::iterator i=l.begin(); i!=l.end(); ++i)
69 for(StringList::iterator j=i; j!=l.end();)
78 BuildInfo::Loader::Loader(BuildInfo &bi):
81 add("cflag", &Loader::cflag);
82 add("incpath", &Loader::incpath);
83 add("define", &Loader::define);
84 add("ldflag", &Loader::ldflag);
85 add("libpath", &Loader::libpath);
86 add("library", &Loader::library);
87 add("warning", &Loader::warning);