+ return best;
+}
+
+template<typename T>
+void Architecture::add_pattern(const string &pat)
+{
+ filename_patterns[typeid(T).name()].push_back(Pattern(pat));
+}
+
+void Architecture::resolve_aliases(vector<string> &parts)
+{
+ for(unsigned i=0; i<parts.size(); ++i)
+ {
+ const string &part = parts[i];
+ const char *replace = 0;
+ for(unsigned j=0; (!replace && aliases[j]); j+=2)
+ if(part==aliases[j])
+ replace = aliases[j+1];
+
+ if(replace)
+ {
+ bool has_dash = false;
+ for(const char *c=replace; (!has_dash && *c); ++c)
+ has_dash = (*c=='-');
+
+ if(has_dash)
+ {
+ vector<string> rparts = split(replace, "-");
+ parts[i] = rparts[0];
+ parts.insert(parts.begin()+i+1, rparts.begin()+1, rparts.end());
+ i += rparts.size()-1;
+ }
+ else
+ parts[i] = replace;
+ }
+ }