@@ -1112,23 +1112,30 @@ ParmParse::hasUnusedInputs (const std::string& prefix)
1112
1112
1113
1113
static
1114
1114
void
1115
- get_unused_inputs (std::vector<std::string>& unused, const ParmParse::Table& table,
1116
- const std::string& prefix)
1115
+ get_entries_under_prefix (std::vector<std::string>& found_entries,
1116
+ const ParmParse::Table& table,
1117
+ const std::string& prefix,
1118
+ const bool only_unused = false ,
1119
+ const bool add_values = false )
1117
1120
{
1118
1121
const std::string prefixdot = prefix.empty () ? std::string () : prefix+" ." ;
1119
1122
for (auto const & entry : table) {
1120
- if (! entry.m_queried ) {
1123
+ if ((! only_unused) || (only_unused && ! entry.m_queried ) ) {
1121
1124
if (entry.m_name .substr (0 ,prefixdot.size ()) == prefixdot) {
1122
- std::string tmp (entry.m_name + " =" );
1123
- for (auto const & v : entry.m_vals ) {
1124
- tmp += " " + v;
1125
+ std::string tmp (entry.m_name );
1126
+ if (add_values) {
1127
+ tmp.append (" =" );
1128
+ for (auto const & v : entry.m_vals ) {
1129
+ tmp += " " + v;
1130
+ }
1125
1131
}
1126
- unused .emplace_back (std::move (tmp));
1132
+ found_entries .emplace_back (std::move (tmp));
1127
1133
}
1128
1134
}
1129
1135
1130
1136
if (entry.m_table ) {
1131
- get_unused_inputs (unused, table, prefix);
1137
+ get_entries_under_prefix (found_entries, table, prefix,
1138
+ only_unused, add_values);
1132
1139
}
1133
1140
}
1134
1141
}
@@ -1137,7 +1144,15 @@ std::vector<std::string>
1137
1144
ParmParse::getUnusedInputs (const std::string& prefix)
1138
1145
{
1139
1146
std::vector<std::string> r;
1140
- get_unused_inputs (r, g_table, prefix);
1147
+ get_entries_under_prefix (r, g_table, prefix, true , true );
1148
+ return r;
1149
+ }
1150
+
1151
+ std::vector<std::string>
1152
+ ParmParse::getEntries (const std::string& prefix)
1153
+ {
1154
+ std::vector<std::string> r;
1155
+ get_entries_under_prefix (r, g_table, prefix, false , false );
1141
1156
return r;
1142
1157
}
1143
1158
0 commit comments