28 const std::string & action,
29 bool is_action_params,
33 _root = std::make_unique<TreeNode>(
"", *
this);
35 _root->insertNode(syntax, action, is_action_params, params);
48 output =
_root->print(-1, search_string, found);
70 const std::string * action,
73 : _name(
name), _parent(parent), _syntax_tree(syntax_tree)
76 _action_params.emplace(*action, std::make_unique<InputParameters>(*params));
83 const std::string & action,
84 bool is_action_params,
87 std::string::size_type pos = syntax.find_first_of(
"/");
91 item = syntax.substr(0, pos);
92 if (pos != std::string::npos)
94 syntax = syntax.substr(pos + 1);
98 bool node_created =
false;
99 if (_children.find(item) == _children.end())
101 _children[item] = std::make_unique<TreeNode>(
102 item, _syntax_tree, is_leaf && is_action_params ? &action : NULL, params,
this);
103 if (is_leaf && !is_action_params)
104 _children[item]->insertParams(action, is_action_params, params);
109 _children[item]->insertNode(syntax, action, is_action_params, params);
110 else if (!node_created)
111 _children[item]->insertParams(action, is_action_params, params);
116 bool is_action_params,
119 if (is_action_params)
120 _action_params.emplace(action, std::make_unique<InputParameters>(*params));
122 _moose_object_params.emplace(action, std::make_unique<InputParameters>(*params));
128 std::string doc =
"";
129 std::string long_name(getLongName());
130 std::string
name(_syntax_tree.isLongNames() ? long_name : _name);
135 for (
const auto & c_it : _children)
137 bool local_found =
false;
138 std::string local_out(c_it.second->print(depth + 1, search_string, local_found));
139 found |= local_found;
150 std::string
indent((depth + 1) * 2,
' ');
152 std::multimap<std::string, std::unique_ptr<InputParameters>>::const_iterator it =
153 _moose_object_params.begin();
156 bool local_found =
false;
157 std::string local_out;
161 std::string local_search_string;
165 local_search_string = search_string;
167 if (it != _moose_object_params.end())
168 doc = it->second->getClassDescription();
169 local_out += _syntax_tree.printBlockOpen(
name, depth, doc);
171 for (
const auto & a_it : _action_params)
172 if (a_it.first !=
"EmptyAction")
174 local_out += _syntax_tree.printParams(
175 name, long_name, *(a_it.second), depth, local_search_string, local_found);
176 found |= local_found;
182 if (it != _moose_object_params.end())
184 local_out += _syntax_tree.printParams(
185 name, long_name, *it->second, depth, local_search_string, local_found);
186 found |= local_found;
192 local_out += _syntax_tree.preTraverse(depth);
194 for (
const auto & c_it : _children)
196 bool child_found =
false;
197 std::string child_out(c_it.second->print(depth + 1, local_search_string, child_found));
198 found |= child_found;
201 local_out += child_out;
204 local_out += _syntax_tree.printBlockClose(
name, depth);
212 }
while (it != _moose_object_params.end() && ++it != _moose_object_params.end());
221 return _parent->getLongName(delim) + delim + _name;
std::string name(const ElemQuality q)
std::string indent(unsigned int spaces)
Create empty string for indenting.
void insertNode(std::string &syntax, const std::string &action, bool is_action_params=true, InputParameters *params=NULL)
std::string getLongName(const std::string &delim="/") const
void insertParams(const std::string &action, bool is_action_params, InputParameters *params=NULL)
std::set< std::string > _params_printed
SyntaxTree(bool use_long_names=false)
TreeNode(const std::string &name, SyntaxTree &syntax_tree, const std::string *action=NULL, InputParameters *params=NULL, TreeNode *parent=NULL)
std::unique_ptr< TreeNode > _root
void insertNode(std::string syntax, const std::string &action, bool is_action_params=true, InputParameters *params=NULL)
std::string print(const std::string &search_string)
std::string print(short depth, const std::string &search_string, bool &found)
std::multimap< std::string, std::unique_ptr< InputParameters > > _action_params
bool wildCardMatch(std::string name, std::string search_string)
bool haveSeenIt(const std::string &prefix, const std::string &item) const
This class represents a single node in our tree.
void seenIt(const std::string &prefix, const std::string &item)