FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
RemovedAttributes.h
1#pragma once
2
12#include <algorithm>
13#include <fhsim/ISimObjectLogger.h>
14#include <fhsim/InputReader.h>
15#include <string>
16#include <vector>
17
18namespace removed_attributes
19{
20
29inline void WarnIfPresent(InputReader& reader, const AttributePath& path, const std::vector<std::string>& removed,
30 const std::string& release, ISimObjectLogger* logger)
31{
32 if (!logger)
33 return;
34 StringPairVector attributes;
35 if (!reader.GetAllAttributes(attributes, path))
36 return;
37 for (const auto& [name, value] : attributes) {
38 if (std::find(removed.begin(), removed.end(), name) != removed.end())
39 logger->LogInfo("Warning: the attribute " + name + "=\"" + value + "\" in " + reader.GetFileAndPath() + " is ignored; it was removed in " + release + ".");
40 }
41}
42
43} // namespace removed_attributes