9 /** Removes any duplicate entries from a list, leaving only the first one. The
10 order of other elements is preserved. O(n²) efficiency. */
11 void unique(StringList &l)
13 for(StringList::iterator i=l.begin(); i!=l.end(); ++i)
14 for(StringList::iterator j=i; j!=l.end();)
26 BuildInfo::BuildInfo():
33 void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level)
35 for(DefineMap::const_iterator i=bi.defines.begin(); i!=bi.defines.end(); ++i)
36 defines[i->first] = i->second;
37 incpath.insert(incpath.end(), bi.incpath.begin(), bi.incpath.end());
40 libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end());
41 libs.insert(libs.end(), bi.libs.begin(), bi.libs.end());
43 warnings.insert(warnings.end(), bi.warnings.begin(), bi.warnings.end());
48 optimize = bi.optimize;
53 void BuildInfo::unique()
59 for(StringList::iterator i=warnings.begin(); i!=warnings.end(); ++i)
61 bool flag = i->compare(0, 3, "no-");
63 string warn = (flag ? *i : i->substr(3));
64 string no_warn = "no-"+warn;
66 for(StringList::iterator j=i; j!=warnings.end();)
68 if(j!=i && (*j==warn || *j==no_warn))
71 j = warnings.erase(j);
77 *i = (flag ? warn : no_warn);
82 BuildInfo::Loader::Loader(BuildInfo &bi):
83 DataFile::ObjectLoader<BuildInfo>(bi)
85 add("debug", &BuildInfo::debug);
86 add("define", &Loader::define);
87 add("incpath", &Loader::incpath);
88 add("libpath", &Loader::libpath);
89 add("library", &Loader::library);
90 add("optimize", &BuildInfo::optimize);
91 add("strip", &BuildInfo::strip);
92 add("threads", &BuildInfo::threads);
93 add("warning", &Loader::warning);
96 void BuildInfo::Loader::incpath(const std::string &s)
98 obj.incpath.push_back(s);
101 void BuildInfo::Loader::define(const std::string &d, const std::string &v)
106 void BuildInfo::Loader::libpath(const std::string &s)
108 obj.libpath.push_back(s);
111 void BuildInfo::Loader::library(const std::string &s)
113 obj.libs.push_back(s);
116 void BuildInfo::Loader::warning(const std::string &s)
118 obj.warnings.push_back(s);