aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-11-16 13:22:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-11-16 13:22:53 +0200
commitfd2a7b79293c67cbaf478c7946b65de9425deea1 (patch)
tree0d95b0e70846750727cdfc8cd46af247864b4db5
parent70ab16316fb4f248b0146d4171ae1efd8472e5cf (diff)
Add ostream operator<< for vcs enum
-rw-r--r--bdep/new-types.hxx20
1 files changed, 13 insertions, 7 deletions
diff --git a/bdep/new-types.hxx b/bdep/new-types.hxx
index 6cfb2b3..59df3cb 100644
--- a/bdep/new-types.hxx
+++ b/bdep/new-types.hxx
@@ -43,7 +43,7 @@ namespace bdep
// Default is exe with no options.
//
- cmd_new_type_template (): type (exe) {}
+ cmd_new_type_template (type_type t = exe): type (t) {}
const std::string
string () const
@@ -62,9 +62,9 @@ namespace bdep
}
friend ostream&
- operator<< (ostream& os, const cmd_new_type_template& t)
+ operator<< (ostream& os, type_type t)
{
- return os << t.string ();
+ return os << cmd_new_type_template (t).string ();
}
};
@@ -88,7 +88,7 @@ namespace bdep
// Default is C++ with no options.
//
- cmd_new_lang_template (): lang (cxx) {}
+ cmd_new_lang_template (lang_type l = cxx): lang (l) {}
const std::string
string (bool lower = false) const
@@ -105,9 +105,9 @@ namespace bdep
}
friend ostream&
- operator<< (ostream& os, const cmd_new_lang_template& l)
+ operator<< (ostream& os, lang_type l)
{
- return os << l.string ();
+ return os << cmd_new_lang_template (l).string ();
}
};
@@ -134,7 +134,7 @@ namespace bdep
// Default is git with no options.
//
- cmd_new_vcs_template (): vcs (git) {}
+ cmd_new_vcs_template (vcs_type v = git): vcs (v) {}
const std::string
string () const
@@ -149,6 +149,12 @@ namespace bdep
return std::string (); // Should never reach.
}
+
+ friend ostream&
+ operator<< (ostream& os, vcs_type v)
+ {
+ return os << cmd_new_vcs_template (v).string ();
+ }
};
using cmd_new_vcs = cmd_new_vcs_template<>;