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;
55 void BuildInfo::unique()
61 for(StringList::iterator i=warnings.begin(); i!=warnings.end(); ++i)
63 bool flag = i->compare(0, 3, "no-");
65 string warn = (flag ? *i : i->substr(3));
66 string no_warn = "no-"+warn;
68 for(StringList::iterator j=i; j!=warnings.end();)
70 if(j!=i && (*j==warn || *j==no_warn))
73 j = warnings.erase(j);
79 *i = (flag ? warn : no_warn);
84 BuildInfo::Loader::Loader(BuildInfo &bi):
85 DataFile::ObjectLoader<BuildInfo>(bi)
87 add("debug", &BuildInfo::debug);
88 add("define", &Loader::define);
89 add("incpath", &Loader::incpath);
90 add("libpath", &Loader::libpath);
91 add("library", &Loader::library);
92 add("optimize", &BuildInfo::optimize);
93 add("strip", &BuildInfo::strip);
94 add("threads", &BuildInfo::threads);
95 add("warning", &Loader::warning);
98 void BuildInfo::Loader::incpath(const std::string &s)
100 obj.incpath.push_back(s);
103 void BuildInfo::Loader::define(const std::string &d, const std::string &v)
108 void BuildInfo::Loader::libpath(const std::string &s)
110 obj.libpath.push_back(s);
113 void BuildInfo::Loader::library(const std::string &s)
115 obj.libs.push_back(s);
118 void BuildInfo::Loader::warning(const std::string &s)
120 obj.warnings.push_back(s);