www.mooseframework.org
Public Member Functions | Public Attributes | Private Attributes | List of all members
BadActiveWalker Class Reference
Inheritance diagram for BadActiveWalker:
[legend]

Public Member Functions

 BadActiveWalker (std::string fname)
 
void walk (const std::string &, const std::string &, hit::Node *section) override
 

Public Attributes

std::vector< std::string > errors
 

Private Attributes

std::string _fname
 

Detailed Description

Definition at line 219 of file Parser.C.

Constructor & Destructor Documentation

◆ BadActiveWalker()

BadActiveWalker::BadActiveWalker ( std::string  fname)
inline

Definition at line 222 of file Parser.C.

222 : _fname(fname) {}
std::string _fname
Definition: Parser.C:286

Member Function Documentation

◆ walk()

void BadActiveWalker::walk ( const std::string &  ,
const std::string &  ,
hit::Node *  section 
)
inlineoverride

Definition at line 223 of file Parser.C.

226  {
227  auto actives = section->find("active");
228  auto inactives = section->find("inactive");
229 
230  if (actives && inactives && actives->type() == hit::NodeType::Field &&
231  inactives->type() == hit::NodeType::Field && actives->parent() == inactives->parent())
232  {
233  errors.push_back(hit::errormsg(
234  _fname, section, "'active' and 'inactive' parameters both provided in section"));
235  return;
236  }
237 
238  // ensures we don't recheck deeper nesting levels
239  if (actives && actives->type() == hit::NodeType::Field && actives->parent() == section)
240  {
241  auto vars = section->param<std::vector<std::string>>("active");
242  std::string msg = "";
243  for (auto & var : vars)
244  {
245  if (!section->find(var))
246  msg += var + ", ";
247  }
248  if (msg.size() > 0)
249  {
250  msg = msg.substr(0, msg.size() - 2);
251  errors.push_back(hit::errormsg(_fname,
252  section,
253  "variables listed as active (",
254  msg,
255  ") in section '",
256  section->fullpath(),
257  "' not found in input"));
258  }
259  }
260  // ensures we don't recheck deeper nesting levels
261  if (inactives && inactives->type() == hit::NodeType::Field && inactives->parent() == section)
262  {
263  auto vars = section->param<std::vector<std::string>>("inactive");
264  std::string msg = "";
265  for (auto & var : vars)
266  {
267  if (!section->find(var))
268  msg += var + ", ";
269  }
270  if (msg.size() > 0)
271  {
272  msg = msg.substr(0, msg.size() - 2);
273  errors.push_back(hit::errormsg(_fname,
274  section,
275  "variables listed as inactive (",
276  msg,
277  ") in section '",
278  section->fullpath(),
279  "' not found in input"));
280  }
281  }
282  }
std::vector< std::string > errors
Definition: Parser.C:283
std::string _fname
Definition: Parser.C:286

Member Data Documentation

◆ _fname

std::string BadActiveWalker::_fname
private

Definition at line 286 of file Parser.C.

Referenced by walk().

◆ errors

std::vector<std::string> BadActiveWalker::errors

Definition at line 283 of file Parser.C.

Referenced by Parser::parse(), and walk().


The documentation for this class was generated from the following file: