@@ -261,11 +261,11 @@ class ResourceRegistry
261
261
std::vector<ResourceRegistryItem> m_items;
262
262
};
263
263
264
- // Look into the current xml element for an attribute's name which match the provided regex
265
- Result<std::optional <XmlString>>
264
+ // Look into the current xml element for an attributes name which match the provided regex
265
+ Result<std::vector <XmlString>>
266
266
GetXmlAttributeValueMatch (const CComPtr<IXmlReader>& reader, std::wstring_view attributeValueRegex)
267
267
{
268
- std::vector<std::wstring > values;
268
+ std::vector<XmlString > values;
269
269
270
270
UINT uiAttrCount = 0 ;
271
271
HRESULT hr = reader->GetAttributeCount (&uiAttrCount);
@@ -277,7 +277,7 @@ GetXmlAttributeValueMatch(const CComPtr<IXmlReader>& reader, std::wstring_view a
277
277
278
278
if (uiAttrCount == 0L )
279
279
{
280
- return std::optional <XmlString> {} ;
280
+ return std::vector <XmlString>() ;
281
281
}
282
282
283
283
hr = reader->MoveToFirstAttribute ();
@@ -316,30 +316,28 @@ GetXmlAttributeValueMatch(const CComPtr<IXmlReader>& reader, std::wstring_view a
316
316
}
317
317
318
318
std::wregex regex (attributeValueRegex.data (), std::regex_constants::icase);
319
- if (! std::regex_search (pValue, regex))
319
+ if (std::regex_search (pValue, regex))
320
320
{
321
- hr = reader->MoveToNextAttribute ();
321
+ UINT lineNumber = 0 ;
322
+ hr = reader->GetLineNumber (&lineNumber);
322
323
if (FAILED (hr))
323
324
{
324
325
XmlLiteExtension::LogError (hr, reader);
325
- return SystemError (hr) ;
326
+ // return ;
326
327
}
327
328
328
- continue ;
329
+ values. emplace_back (XmlString {{}, lineNumber, pValue}) ;
329
330
}
330
331
331
- UINT lineNumber = 0 ;
332
- hr = reader->GetLineNumber (&lineNumber);
332
+ hr = reader->MoveToNextAttribute ();
333
333
if (FAILED (hr))
334
334
{
335
335
XmlLiteExtension::LogError (hr, reader);
336
- // return;
336
+ return SystemError (hr) ;
337
337
}
338
-
339
- return XmlString {{}, lineNumber, pValue};
340
338
}
341
339
342
- return std::optional<XmlString> {} ;
340
+ return values ;
343
341
}
344
342
345
343
// Look into the current xml file for all attributes name which match the provided regex
@@ -380,9 +378,10 @@ GetXmlAttributesValueMatch(const std::shared_ptr<ByteStream>& xmlStream, std::ws
380
378
continue ;
381
379
}
382
380
383
- if ((* result). has_value ())
381
+ if (! result-> empty ())
384
382
{
385
- values.emplace_back (std::move (**result));
383
+ std::move (std::begin (*result), std::end (*result), std::back_inserter (values));
384
+ result->clear ();
386
385
}
387
386
}
388
387
0 commit comments