blob: 66769d1b28aa0a4fda93587f4a25d997bfa5b6a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// file : bpkg/package.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <bpkg/package>
#include <stdexcept> // invalid_argument
using namespace std;
namespace bpkg
{
string
to_string (state s)
{
switch (s)
{
case state::broken: return "broken";
case state::fetched: return "fetched";
case state::unpacked: return "unpacked";
case state::configured: return "configured";
}
return string (); // Should never reach.
}
state
from_string (const string& s)
{
if (s == "broken") return state::broken;
else if (s == "fetched") return state::fetched;
else if (s == "unpacked") return state::unpacked;
else if (s == "configured") return state::configured;
else throw invalid_argument (s);
}
}
|