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 void BuildInfo::add(const BuildInfo &bi)
28 cflags.insert(cflags.end(), bi.cflags.begin(), bi.cflags.end());
29 defines.insert(defines.end(), bi.defines.begin(), bi.defines.end());
30 incpath.insert(incpath.end(), bi.incpath.begin(), bi.incpath.end());
31 ldflags.insert(ldflags.end(), bi.ldflags.begin(), bi.ldflags.end());
32 libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end());
33 libs.insert(libs.end(), bi.libs.begin(), bi.libs.end());
34 warnings.insert(warnings.end(), bi.warnings.begin(), bi.warnings.end());
37 void BuildInfo::unique()
46 for(StringList::iterator i=warnings.begin(); i!=warnings.end(); ++i)
48 bool flag = i->compare(0, 3, "no-");
50 string warn = (flag ? *i : i->substr(3));
51 string no_warn = "no-"+warn;
53 for(StringList::iterator j=i; j!=warnings.end();)
55 if(j!=i && (*j==warn || *j==no_warn))
58 j = warnings.erase(j);
64 *i = (flag ? warn : no_warn);
69 BuildInfo::Loader::Loader(BuildInfo &bi):
72 add("cflag", &Loader::cflag);
73 add("incpath", &Loader::incpath);
74 add("define", &Loader::define);
75 add("ldflag", &Loader::ldflag);
76 add("libpath", &Loader::libpath);
77 add("library", &Loader::library);
78 add("warning", &Loader::warning);
81 void BuildInfo::Loader::cflag(const std::string &s)
83 binfo.cflags.push_back(s);
86 void BuildInfo::Loader::incpath(const std::string &s)
88 binfo.incpath.push_back(s);
91 void BuildInfo::Loader::define(const std::string &s)
93 binfo.defines.push_back(s);
96 void BuildInfo::Loader::ldflag(const std::string &s)
98 binfo.ldflags.push_back(s);
101 void BuildInfo::Loader::libpath(const std::string &s)
103 binfo.libpath.push_back(s);
106 void BuildInfo::Loader::library(const std::string &s)
108 binfo.libs.push_back(s);
111 void BuildInfo::Loader::warning(const std::string &s)
113 binfo.warnings.push_back(s);