Mercurial > hg > sonic-annotator
comparison runner/JAMSFeatureWriter.cpp @ 197:3b7ec45abd1c
Add mandatory option --json-format to JSON feature writer, in preparation for supporting multiple JSON formats (perhaps) in future
author | Chris Cannam |
---|---|
date | Tue, 01 Sep 2015 17:05:32 +0100 |
parents | bb295c0feb3e |
children | f35bbb3e4d41 |
comparison
equal
deleted
inserted
replaced
196:082c3f21f49e | 197:3b7ec45abd1c |
---|---|
55 { | 55 { |
56 ParameterList pl = FileFeatureWriter::getSupportedParameters(); | 56 ParameterList pl = FileFeatureWriter::getSupportedParameters(); |
57 Parameter p; | 57 Parameter p; |
58 | 58 |
59 p.name = "network"; | 59 p.name = "network"; |
60 p.description = "Attempt to retrieve RDF descriptions of plugins from network, if not available locally"; | 60 p.description = "Attempt to retrieve RDF descriptions of plugins from network, if not available locally."; |
61 p.hasArg = false; | 61 p.hasArg = false; |
62 pl.push_back(p); | |
63 | |
64 p.name = "format"; | |
65 p.description = "JSON format to use. Currently the only supported value is \"jams\". Other formats may be supported in future."; | |
66 p.hasArg = true; | |
67 p.mandatory = true; | |
62 pl.push_back(p); | 68 pl.push_back(p); |
63 | 69 |
64 return pl; | 70 return pl; |
65 } | 71 } |
66 | 72 |
71 | 77 |
72 for (map<string, string>::iterator i = params.begin(); | 78 for (map<string, string>::iterator i = params.begin(); |
73 i != params.end(); ++i) { | 79 i != params.end(); ++i) { |
74 if (i->first == "network") { | 80 if (i->first == "network") { |
75 m_network = true; | 81 m_network = true; |
82 } else if (i->first == "format") { | |
83 if (i->second == "jams") { | |
84 m_format = i->second; | |
85 } else { | |
86 throw std::runtime_error | |
87 ("Unknown or invalid --json-format parameter \"" + i->second + "\""); | |
88 } | |
76 } | 89 } |
77 } | 90 } |
78 } | 91 } |
79 | 92 |
80 void | 93 void |