diff options
Diffstat (limited to 'libbrep/common.cxx')
-rw-r--r-- | libbrep/common.cxx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libbrep/common.cxx b/libbrep/common.cxx index b2429a6..4f729a3 100644 --- a/libbrep/common.cxx +++ b/libbrep/common.cxx @@ -1,5 +1,4 @@ // file : libbrep/common.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #include <libbrep/common.hxx> @@ -7,4 +6,30 @@ namespace brep { const version wildcard_version (0, "0", nullopt, nullopt, 0); + + // unbuildable_reason + // + string + to_string (unbuildable_reason r) + { + switch (r) + { + case unbuildable_reason::stub: return "stub"; + case unbuildable_reason::test: return "test"; + case unbuildable_reason::external: return "external"; + case unbuildable_reason::unbuildable: return "unbuildable"; + } + + return string (); // Should never reach. + } + + unbuildable_reason + to_unbuildable_reason (const string& r) + { + if (r == "stub") return unbuildable_reason::stub; + else if (r == "test") return unbuildable_reason::test; + else if (r == "external") return unbuildable_reason::external; + else if (r == "unbuildable") return unbuildable_reason::unbuildable; + else throw invalid_argument ("invalid unbuildable reason '" + r + '\''); + } } |