aboutsummaryrefslogtreecommitdiff
path: root/bbot/manifest.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-04-06 18:58:03 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-04-06 20:26:21 +0300
commitef0e6c709051fc46968d64dcf1c86bd197fe45c2 (patch)
tree5873b9ac6c638c1097bb988213a86593902c02eb /bbot/manifest.cxx
parenta1ca1cff56f05c9d49ccb8edac2a4c6b191199fd (diff)
Invent notion of header for machine_manifest
Diffstat (limited to 'bbot/manifest.cxx')
-rw-r--r--bbot/manifest.cxx40
1 files changed, 17 insertions, 23 deletions
diff --git a/bbot/manifest.cxx b/bbot/manifest.cxx
index b9c623e..a40d633 100644
--- a/bbot/manifest.cxx
+++ b/bbot/manifest.cxx
@@ -80,13 +80,7 @@ namespace bbot
}
machine_manifest::
- machine_manifest (parser& p, name_value nv, bool iu)
- : machine_manifest (p, nv, true, iu)
- {
- }
-
- machine_manifest::
- machine_manifest (parser& p, name_value nv, bool il, bool iu)
+ machine_manifest (parser& p, name_value nv, bool ho, bool iu)
{
auto bad_name = [&p, &nv] (const string& d)
{
@@ -131,9 +125,19 @@ namespace bbot
name = move (v);
}
+ else if (n == "summary")
+ {
+ if (!summary.empty ())
+ bad_name ("machine summary redefinition");
+
+ if (v.empty ())
+ bad_value ("empty machine summary");
+
+ summary = move (v);
+ }
else if (n == "type")
{
- if (il)
+ if (ho)
bad_name ("machine type not allowed");
if (type)
@@ -148,16 +152,6 @@ namespace bbot
type = static_cast<machine_type> (i - b);
}
- else if (n == "summary")
- {
- if (!summary.empty ())
- bad_name ("machine summary redefinition");
-
- if (v.empty ())
- bad_value ("empty machine summary");
-
- summary = move (v);
- }
else if (!iu)
bad_name ("unknown name '" + n + "' in machine manifest");
}
@@ -170,11 +164,11 @@ namespace bbot
if (name.empty ())
bad_value ("no machine name specified");
- if (!il && !type)
- bad_value ("no machine type specified");
-
if (summary.empty ())
bad_value ("no machine summary specified");
+
+ if (!ho && !type)
+ bad_value ("no machine type specified");
}
void machine_manifest::
@@ -186,6 +180,7 @@ namespace bbot
s.next ("", "1"); // Start of manifest.
s.next ("id", id);
s.next ("name", name);
+ s.next ("summary", summary);
if (type)
{
@@ -194,7 +189,6 @@ namespace bbot
s.next ("type", machine_type_names[v]);
}
- s.next ("summary", summary);
s.next ("", ""); // End of manifest.
}
@@ -265,7 +259,7 @@ namespace bbot
// Parse machine manifests.
//
for (nv = p.next (); !nv.empty (); nv = p.next ())
- machines.emplace_back (machine_manifest (p, nv, iu));
+ machines.emplace_back (machine_manifest (p, nv, true, iu));
if (machines.empty ())
bad_value ("no task request machines specified");