* Find the value of a template variable. * @param name Name of the item to find. * @param grp Group currently being expanded (searched first). * @param defaults Fallback group to search, \c nullptr skips the search. * @return Text of the item if found, else \c std::nullopt. */
| 205 | * @return Text of the item if found, else \c std::nullopt. |
| 206 | */ |
| 207 | static std::optional<std::string_view> FindItemValue(std::string_view name, const IniGroup *grp, const IniGroup *defaults) |
| 208 | { |
| 209 | const IniItem *item = grp->GetItem(name); |
| 210 | if (item == nullptr && defaults != nullptr) item = defaults->GetItem(name); |
| 211 | if (item == nullptr) return std::nullopt; |
| 212 | return item->value; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * Parse a single entry via a template and output this. |