30 #include <boost/algorithm/string.hpp> 31 #if BOOST_VERSION < 106500 32 #include <boost/tr1/unordered_set.hpp> 34 #include <boost/unordered_set.hpp> 45 std::string& outstring)
47 std::vector<std::string> vec;
48 #if BOOST_VERSION < 106500 49 std::tr1::unordered_set<std::string>
set;
51 boost::unordered_set<std::string>
set;
53 boost::split(vec, instring,
54 boost::is_any_of(
"\t "),
55 boost::token_compress_on);
57 std::reverse(vec.begin(), vec.end());
58 std::vector<std::string> vec_out;
59 for(std::vector<std::string>::const_iterator it = vec.begin();
63 if(
set.find(*it) ==
set.end())
65 vec_out.push_back(*it);
70 std::reverse(vec_out.begin(), vec_out.end());
71 for(std::vector<std::string>::const_iterator it = vec_out.begin();
75 if(it == vec_out.begin())
76 outstring.append(*it);
78 outstring.append(std::string(
" ") + *it);
84 const std::string& token,
87 std::string& outstring)
89 std::string intermediate;
90 std::vector<std::string> result_vec;
91 boost::split(result_vec, instring,
92 boost::is_any_of(
"\t "),
93 boost::token_compress_on);
94 for(std::vector<std::string>::const_iterator it = result_vec.begin();
95 it != result_vec.end();
99 if(it->size() > token.size() && it->substr(0,token.size()) == token)
103 if(intermediate.size())
104 intermediate.append(
" ");
105 intermediate.append(it->substr(token.size()));
109 else if((*it) == token)
111 std::vector<std::string>::const_iterator iit = it;
112 if(++iit != result_vec.end())
114 if(it->size() >= token.size() && it->substr(0,token.size()) == token)
122 if(intermediate.size())
123 intermediate.append(
" ");
124 intermediate.append((*iit));
131 else if(it->size() > 2 &&
133 it->substr(it->size()-2) ==
".a")
137 if(intermediate.size())
138 intermediate.append(
" ");
139 intermediate.append((*it));
144 if(intermediate.size())
145 intermediate.append(
" ");
146 intermediate.append((*it));
152 outstring = intermediate;
void parse_compiler_flags(const std::string &instring, const std::string &token, bool select, bool last, std::string &outstring)
void deduplicate_tokens(const std::string &instring, bool last, std::string &outstring)