mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Don't hard-code references to the global config in the
updateConfigForFilename() methods.
This commit is contained in:
@@ -32,15 +32,14 @@ std::unique_ptr<FluxSink> FluxSink::create(const FluxSinkProto& config)
|
||||
return std::unique_ptr<FluxSink>();
|
||||
}
|
||||
|
||||
void FluxSink::updateConfigForFilename(const std::string& filename)
|
||||
void FluxSink::updateConfigForFilename(FluxSinkProto* proto, const std::string& filename)
|
||||
{
|
||||
FluxSinkProto* f = config.mutable_output()->mutable_flux();
|
||||
static const std::vector<std::pair<std::regex, std::function<void(const std::string&)>>> formats =
|
||||
{
|
||||
{ std::regex("^(.*\\.flux)$"), [&](const auto& s) { f->set_fluxfile(s); }},
|
||||
{ std::regex("^(.*\\.scp)$"), [&](const auto& s) { f->mutable_scp()->set_filename(s); }},
|
||||
{ std::regex("^vcd:(.*)$"), [&](const auto& s) { f->mutable_vcd()->set_directory(s); }},
|
||||
{ std::regex("^au:(.*)$"), [&](const auto& s) { f->mutable_au()->set_directory(s); }},
|
||||
{ std::regex("^(.*\\.flux)$"), [&](const auto& s) { proto->set_fluxfile(s); }},
|
||||
{ std::regex("^(.*\\.scp)$"), [&](const auto& s) { proto->mutable_scp()->set_filename(s); }},
|
||||
{ std::regex("^vcd:(.*)$"), [&](const auto& s) { proto->mutable_vcd()->set_directory(s); }},
|
||||
{ std::regex("^au:(.*)$"), [&](const auto& s) { proto->mutable_au()->set_directory(s); }},
|
||||
};
|
||||
|
||||
for (const auto& it : formats)
|
||||
|
||||
Reference in New Issue
Block a user