From d37709e5c27b1fe7b98de57247449c6272c79580 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 3 Jun 2019 12:59:26 +0300 Subject: Adapt to renaming traits alias to traits_type for basic_path, basic_url, and string_table class templates --- build2/algorithm.cxx | 2 +- build2/b.cxx | 2 +- build2/bash/rule.cxx | 4 ++-- build2/bin/init.cxx | 14 ++++++++++---- build2/cc/common.cxx | 6 +++--- build2/cc/compile-rule.cxx | 23 ++++++++++++----------- build2/cc/guess.cxx | 4 ++-- build2/cc/link-rule.cxx | 4 ++-- build2/cc/pkgconfig.cxx | 4 ++-- build2/cc/windows-rpath.cxx | 4 ++-- build2/context.cxx | 6 +++--- build2/depdb.hxx | 3 ++- build2/dist/operation.cxx | 2 +- build2/dump.cxx | 2 +- build2/file.cxx | 2 +- build2/functions-filesystem.cxx | 2 +- build2/functions-path.cxx | 4 ++-- build2/install/rule.cxx | 2 +- build2/name.ixx | 2 +- build2/parser.cxx | 12 ++++++------ build2/scope.cxx | 2 +- build2/target.cxx | 8 ++++---- build2/utility.ixx | 2 +- 23 files changed, 62 insertions(+), 54 deletions(-) diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index f9f0ea2..0b7697d 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -1952,7 +1952,7 @@ namespace build2 path p; bool d; - if (path::traits::absolute (e)) + if (path::traits_type::absolute (e)) { p = path (e); d = p.to_directory (); diff --git a/build2/b.cxx b/build2/b.cxx index 022df9d..a64c5e2 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -785,7 +785,7 @@ main (int argc, char* argv[]) // We cannot assume it is a valid filesystem name so we // will have to do the splitting manually. // - path::size_type i (path::traits::rfind_separator (v)); + path::size_type i (path::traits_type::rfind_separator (v)); if (i != string::npos) out_base = dir_path (v, i != 0 ? i : 1); // Special case: "/". diff --git a/build2/bash/rule.cxx b/build2/bash/rule.cxx index cc5d256..09cc930 100644 --- a/build2/bash/rule.cxx +++ b/build2/bash/rule.cxx @@ -138,7 +138,7 @@ namespace build2 b != nullptr; b = (e != nullptr ? e + 1 : e)) { - e = strchr (b, path::traits::path_separator); + e = strchr (b, path::traits_type::path_separator); // Empty path (i.e., a double colon or a colon at the beginning or // end of PATH) means search in the current dirrectory. We aren't @@ -270,7 +270,7 @@ namespace build2 const string& ps (pp.string ()); const string& is (ip.string ()); - if (path::traits::compare ( + if (path::traits_type::compare ( ps.c_str () + ps.size () - n, n, is.c_str (), is.size ()) == 0) { diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx index 26364b4..31431a3 100644 --- a/build2/bin/init.cxx +++ b/build2/bin/init.cxx @@ -364,7 +364,7 @@ namespace build2 const string& s (cast (l)); if (s.empty () || - (!path::traits::is_separator (s.back ()) && + (!path::traits_type::is_separator (s.back ()) && s.find ('*') == string::npos)) { fail << "missing '*' in binutils pattern '" << s << "'"; @@ -605,7 +605,9 @@ namespace build2 // This can be either a pattern or a fallback search directory. // const string* pat (cast_null (rs["bin.pattern"])); - bool fb (pat != nullptr && path::traits::is_separator (pat->back ())); + + bool fb (pat != nullptr && + path::traits_type::is_separator (pat->back ())); // Don't save the default value to config.build so that if the user // changes, say, the C++ compiler (which hinted the pattern), then @@ -763,7 +765,9 @@ namespace build2 // This can be either a pattern or a fallback search directory. // const string* pat (cast_null (rs["bin.pattern"])); - bool fb (pat != nullptr && path::traits::is_separator (pat->back ())); + + bool fb (pat != nullptr && + path::traits_type::is_separator (pat->back ())); auto p ( config::required ( @@ -874,7 +878,9 @@ namespace build2 // This can be either a pattern or a fallback search directory. // const string* pat (cast_null (rs["bin.pattern"])); - bool fb (pat != nullptr && path::traits::is_separator (pat->back ())); + + bool fb (pat != nullptr && + path::traits_type::is_separator (pat->back ())); auto p ( config::required ( diff --git a/build2/cc/common.cxx b/build2/cc/common.cxx index d4c60ec..085ed41 100644 --- a/build2/cc/common.cxx +++ b/build2/cc/common.cxx @@ -179,8 +179,8 @@ namespace build2 if (pn > dn && p.compare (0, dn, ds) == 0 && - (path::traits::is_separator (ds[dn - 1]) || - path::traits::is_separator (p[dn]))) + (path::traits_type::is_separator (ds[dn - 1]) || + path::traits_type::is_separator (p[dn]))) return true; } @@ -277,7 +277,7 @@ namespace build2 // auto sys_simple = [&sysd, &sys, &find_sysd] (const string& p) -> bool { - bool s (!path::traits::absolute (p)); + bool s (!path::traits_type::absolute (p)); if (!s) { diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index 94e50cd..170e358 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -1549,7 +1549,7 @@ namespace build2 if (p > 1 && p + 1 < l.size () && // 2 chars before, 1 after. l[p - 2] == ' ' && alpha (l[p - 1]) && - path::traits::is_separator (l[p + 1])) + path::traits_type::is_separator (l[p + 1])) p = l.rfind (':', p - 2); } @@ -2006,13 +2006,14 @@ namespace build2 // if (const strings* ih = import_hdr) { - auto i (lower_bound (ih->begin (), - ih->end (), - hp, - [] (const string& x, const string& y) - { - return path::traits::compare (x, y) < 0; - })); + auto i ( + lower_bound (ih->begin (), + ih->end (), + hp, + [] (const string& x, const string& y) + { + return path::traits_type::compare (x, y) < 0; + })); if (i != ih->end () && *i == hp) { @@ -2745,8 +2746,8 @@ namespace build2 // -I$src/out_*). We just need to add a trailing directory // separator if it's not already there. // - if (!dir_path::traits::is_separator (ds.back ())) - ds += dir_path::traits::directory_separator; + if (!dir_path::traits_type::is_separator (ds.back ())) + ds += dir_path::traits_type::directory_separator; dir_path d (move (ds), dir_path::exact); // Move the buffer in. @@ -4383,7 +4384,7 @@ namespace build2 // FOObar // bool fs (fc == '_' || fc == '-' || fc == '.' || - path::traits::is_separator (fc)); + path::traits_type::is_separator (fc)); bool ms (mc == '_' || mc == '.'); if (fs && ms) diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx index 0932083..f5db253 100644 --- a/build2/cc/guess.cxx +++ b/build2/cc/guess.cxx @@ -219,7 +219,7 @@ namespace build2 // Analyze the last path component only. // const string& s (xc.string ()); - size_t s_p (path::traits::find_leaf (s)); + size_t s_p (path::traits_type::find_leaf (s)); size_t s_n (s.size ()); // Name separator characters (e.g., '-' in 'g++-4.8'). @@ -1810,7 +1810,7 @@ namespace build2 { if (pre.second != 0 && pre.second != string::npos && - !path::traits::is_separator (xc.string ()[pre.second - 1])) + !path::traits_type::is_separator (xc.string ()[pre.second - 1])) { r.bin_pattern.assign (xc.string (), 0, pre.second); r.bin_pattern += '*'; // '-' or similar is already there. diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index 80ba503..372d077 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -1528,7 +1528,7 @@ namespace build2 // better than checking for a platform-specific extension (maybe // we should cache it somewhere). // - size_t p (path::traits::find_extension (f)); + size_t p (path::traits_type::find_extension (f)); if (p == string::npos) return; @@ -1553,7 +1553,7 @@ namespace build2 // string o (d.link ? "-Wl,-rpath-link," : "-Wl,-rpath,"); - size_t p (path::traits::rfind_separator (f)); + size_t p (path::traits_type::rfind_separator (f)); assert (p != string::npos); o.append (f, 0, (p != 0 ? p : 1)); // Don't include trailing slash. diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index 6f30dc9..dcf3cff 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -1317,7 +1317,7 @@ namespace build2 auto strip_lib = [&n] () { if (n.size () > 3 && - path::traits::compare (n.c_str (), 3, "lib", 3) == 0) + path::traits_type::compare (n.c_str (), 3, "lib", 3) == 0) n.erase (0, 3); }; @@ -1328,7 +1328,7 @@ namespace build2 // n = t->path ().leaf ().base ().base ().string (); - if (path::traits::compare (n.c_str (), n.size (), + if (path::traits_type::compare (n.c_str (), n.size (), l.name.c_str (), l.name.size ()) != 0) strip_lib (); } diff --git a/build2/cc/windows-rpath.cxx b/build2/cc/windows-rpath.cxx index 0a19db2..9ad2602 100644 --- a/build2/cc/windows-rpath.cxx +++ b/build2/cc/windows-rpath.cxx @@ -92,7 +92,7 @@ namespace build2 // // Though this can happen on MinGW with direct DLL link... // - size_t p (path::traits::find_extension (f)); + size_t p (path::traits_type::find_extension (f)); if (p == string::npos || casecmp (f.c_str () + p + 1, "dll") != 0) return; @@ -170,7 +170,7 @@ namespace build2 } else { - size_t p (path::traits::find_extension (f)); + size_t p (path::traits_type::find_extension (f)); if (p != string::npos && casecmp (f.c_str () + p + 1, "dll") == 0) { diff --git a/build2/context.cxx b/build2/context.cxx index aa75b6c..a4ff001 100644 --- a/build2/context.cxx +++ b/build2/context.cxx @@ -606,7 +606,7 @@ namespace build2 if (t.type == token_type::word) { string& v (t.value); - size_t p (path::traits::rfind_separator (v)); + size_t p (path::traits_type::rfind_separator (v)); if (p != string::npos && p != 0) // If first then visibility. { @@ -631,7 +631,7 @@ namespace build2 // If double separator (visibility marker), then keep the first in // name. // - if (p != 0 && path::traits::is_separator (v[p - 1])) + if (p != 0 && path::traits_type::is_separator (v[p - 1])) --p; dir = dir_path (t.value, 0, p + 1); // Include the separator. @@ -673,7 +673,7 @@ namespace build2 // char c (t.value[0]); - if (path::traits::is_separator (c)) + if (path::traits_type::is_separator (c)) c = '/'; // Normalize. string n (t.value, c == '!' || c == '%' || c == '/' ? 1 : 0); diff --git a/build2/depdb.hxx b/build2/depdb.hxx index af9b9e3..95d9f4b 100644 --- a/build2/depdb.hxx +++ b/build2/depdb.hxx @@ -228,7 +228,8 @@ namespace build2 expect (const path_type& v) { string* l (read ()); - if (l == nullptr || path_type::traits::compare (*l, v.string ()) != 0) + if (l == nullptr || + path_type::traits_type::compare (*l, v.string ()) != 0) { write (v); return l; diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx index d59112c..142ca28 100644 --- a/build2/dist/operation.cxx +++ b/build2/dist/operation.cxx @@ -453,7 +453,7 @@ namespace build2 d /= p.directory (); const string& s (p.string ()); - size_t i (path::traits::find_leaf (s)); + size_t i (path::traits_type::find_leaf (s)); if (i == string::npos) fail << "invalid extension '" << s << "' in " << what; diff --git a/build2/dump.cxx b/build2/dump.cxx index d9a1855..3b5d205 100644 --- a/build2/dump.cxx +++ b/build2/dump.cxx @@ -363,7 +363,7 @@ namespace build2 // separator. // if (d.empty ()) - os << ind << dir_path::traits::directory_separator; + os << ind << dir_path::traits_type::directory_separator; else { const dir_path& rd (rel ? relative (d) : d); diff --git a/build2/file.cxx b/build2/file.cxx index 139cf99..f75dd3f 100644 --- a/build2/file.cxx +++ b/build2/file.cxx @@ -64,7 +64,7 @@ namespace build2 // See find_subprojects() for details. // const project_name& n ( - path::traits::is_separator (i->first.string ().back ()) + path::traits_type::is_separator (i->first.string ().back ()) ? empty_project_name : i->first); diff --git a/build2/functions-filesystem.cxx b/build2/functions-filesystem.cxx index 75d882f..a3b2a40 100644 --- a/build2/functions-filesystem.cxx +++ b/build2/functions-filesystem.cxx @@ -203,7 +203,7 @@ namespace build2 { return a.size () == 1 && (a[0].directory () || - a[0].value.find_first_of (path::traits::directory_separators) != + a[0].value.find_first_of (path::traits_type::directory_separators) != string::npos); }; diff --git a/build2/functions-path.cxx b/build2/functions-path.cxx index 1bd4fc7..6b435f5 100644 --- a/build2/functions-path.cxx +++ b/build2/functions-path.cxx @@ -25,7 +25,7 @@ namespace build2 static value concat_path_string (path l, string sr) { - if (path::traits::is_separator (sr[0])) // '\0' if empty. + if (path::traits_type::is_separator (sr[0])) // '\0' if empty. { sr.erase (0, 1); path pr (move (sr)); @@ -49,7 +49,7 @@ namespace build2 static value concat_dir_path_string (dir_path l, string sr) { - if (path::traits::is_separator (sr[0])) // '\0' if empty. + if (path::traits_type::is_separator (sr[0])) // '\0' if empty. sr.erase (0, 1); path pr (move (sr)); diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx index 85bd501..a17cc0d 100644 --- a/build2/install/rule.cxx +++ b/build2/install/rule.cxx @@ -789,7 +789,7 @@ namespace build2 if (!name.empty ()) { - reld += path::traits::directory_separator; + reld += path::traits_type::directory_separator; reld += name.string (); } diff --git a/build2/name.ixx b/build2/name.ixx index ac98b33..79b3145 100644 --- a/build2/name.ixx +++ b/build2/name.ixx @@ -27,7 +27,7 @@ namespace build2 inline name to_name (string s) { - if (!s.empty () && path::traits::is_separator (s.back ())) + if (!s.empty () && path::traits_type::is_separator (s.back ())) { dir_path d (move (s), dir_path::exact); diff --git a/build2/parser.cxx b/build2/parser.cxx index 12dcd54..f422c2f 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -1491,7 +1491,7 @@ namespace build2 a = true; else { - a = path::traits::is_separator (n.value.back ()); + a = path::traits_type::is_separator (n.value.back ()); p /= path (move (n.value)); } @@ -3391,7 +3391,7 @@ namespace build2 { // Use path comparison (which may be slash/case-insensitive). // - return path::traits::compare ( + return path::traits_type::compare ( v, dir ? n.dir.representation () : n.value) == 0; }; @@ -3475,7 +3475,7 @@ namespace build2 // have a sufficiently setup project root). // const string& s (m.string ()); - if ((p[0] != '.' && s[path::traits::find_leaf (s)] == '.') || + if ((p[0] != '.' && s[path::traits_type::find_leaf (s)] == '.') || (root_ != nullptr && root_->root_extra != nullptr && m.to_directory () && @@ -3589,11 +3589,11 @@ namespace build2 if (tt != nullptr && tt->pattern != nullptr) { a = tt->pattern (*tt, *scope_, v, e, l, false); - d = path::traits::is_separator (v.back ()); + d = path::traits_type::is_separator (v.back ()); } else { - d = path::traits::is_separator (v.back ()); + d = path::traits_type::is_separator (v.back ()); if (!d) e = target::split_name (v, l); @@ -3870,7 +3870,7 @@ namespace build2 // in our buildfile "syntax". // const string parser::name_separators ( - string (path::traits::directory_separators) + '%'); + string (path::traits_type::directory_separators) + '%'); auto parser:: parse_names (token& t, type& tt, diff --git a/build2/scope.cxx b/build2/scope.cxx index ec2776e..a6ebe1f 100644 --- a/build2/scope.cxx +++ b/build2/scope.cxx @@ -681,7 +681,7 @@ namespace build2 // // See also parser::expand_name_pattern() if changing anything here. // - size_t p (path::traits::rfind_separator (v)); + size_t p (path::traits_type::rfind_separator (v)); if (p != string::npos) { diff --git a/build2/target.cxx b/build2/target.cxx index 667933a..fee77b4 100644 --- a/build2/target.cxx +++ b/build2/target.cxx @@ -233,7 +233,7 @@ namespace build2 size_t p; if (v.back () != '.') { - if ((p = path::traits::find_extension (v)) != string::npos) + if ((p = path::traits_type::find_extension (v)) != string::npos) r = string (v.c_str () + p + 1); } else @@ -285,7 +285,7 @@ namespace build2 } else if (de) { - if (path::traits::find_extension (v) != string::npos) + if (path::traits_type::find_extension (v) != string::npos) v += "..."; } } @@ -966,7 +966,7 @@ namespace build2 { // Add/strip trailing directory separator unless already there. // - bool d (path::traits::is_separator (v.back ())); + bool d (path::traits_type::is_separator (v.back ())); if (r) { @@ -975,7 +975,7 @@ namespace build2 } else if (!d) { - v += path::traits::directory_separator; + v += path::traits_type::directory_separator; return true; } diff --git a/build2/utility.ixx b/build2/utility.ixx index b9f21b2..1b1fe79 100644 --- a/build2/utility.ixx +++ b/build2/utility.ixx @@ -15,7 +15,7 @@ namespace build2 if (!prefix.empty () && p.sub (prefix)) { s += prefix.size (); // Does not include trailing slash except for root. - if (path::traits::is_separator (*s)) + if (path::traits_type::is_separator (*s)) ++s; } -- cgit v1.1