10 /** Removes any duplicate entries from a list, leaving only the first one. The
11 order of other elements is preserved. O(nlogn) efficiency. */
13 void unique(list<T> &l)
16 for(typename list<T>::iterator i=l.begin(); i!=l.end(); )
28 BuildInfo::BuildInfo():
35 void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level)
37 for(DefineMap::const_iterator i=bi.defines.begin(); i!=bi.defines.end(); ++i)
38 defines[i->first] = i->second;
39 incpath.insert(incpath.end(), bi.incpath.begin(), bi.incpath.end());
42 libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end());
43 libs.insert(libs.end(), bi.libs.begin(), bi.libs.end());
45 warnings.insert(warnings.end(), bi.warnings.begin(), bi.warnings.end());
50 optimize = bi.optimize;
57 void BuildInfo::unique()
63 for(WordList::iterator i=warnings.begin(); i!=warnings.end(); ++i)
65 bool flag = i->compare(0, 3, "no-");
67 string warn = (flag ? *i : i->substr(3));
68 string no_warn = "no-"+warn;
70 for(WordList::iterator j=i; j!=warnings.end();)
72 if(j!=i && (*j==warn || *j==no_warn))
75 j = warnings.erase(j);
81 *i = (flag ? warn : no_warn);
86 BuildInfo::Loader::Loader(BuildInfo &bi):
87 DataFile::ObjectLoader<BuildInfo>(bi)
89 add("debug", &BuildInfo::debug);
90 add("define", &Loader::define);
91 add("incpath", &Loader::incpath);
92 add("libpath", &Loader::libpath);
93 add("library", &Loader::library);
94 add("optimize", &BuildInfo::optimize);
95 add("strip", &BuildInfo::strip);
96 add("threads", &BuildInfo::threads);
97 add("warning", &Loader::warning);
100 void BuildInfo::Loader::incpath(const string &s)
102 obj.incpath.push_back(s);
105 void BuildInfo::Loader::define(const string &d, const string &v)
110 void BuildInfo::Loader::libpath(const string &s)
112 obj.libpath.push_back(s);
115 void BuildInfo::Loader::library(const string &s)
117 obj.libs.push_back(s);
120 void BuildInfo::Loader::warning(const string &s)
122 obj.warnings.push_back(s);