@@ -371,11 +371,11 @@ string InputReader::getLine () {
371371
372372/* * Parses a sequence of key-value pairs of the form KEY=VALUE or KEY="VALUE".
373373 * If parameter 'requireValues' is false, attributes may also consist of a key only.
374- * @param[out] attr the scanned attributes
375374 * @param[in] requireValues true if all attributes require a value
376375 * @param[in] quotechars recognized quote characters used to enclose the attribute values
377- * @return number of attributes scanned */
378- int InputReader::parseAttributes (map<string,string> &attr, bool requireValues, const char *quotechars) {
376+ * @return the scanned attributes */
377+ map<string,string> InputReader::parseAttributes (bool requireValues, const char *quotechars) {
378+ map<string,string> attribs;
379379 while (!eof ()) {
380380 string key;
381381 skipSpace ();
@@ -389,12 +389,24 @@ int InputReader::parseAttributes (map<string,string> &attr, bool requireValues,
389389 get ();
390390 skipSpace ();
391391 string val = getQuotedString (quotechars);
392- attr .emplace (std::move (key), std::move (val));
392+ attribs .emplace (std::move (key), std::move (val));
393393 }
394394 else if (!requireValues)
395- attr .emplace (std::move (key), " " );
395+ attribs .emplace (std::move (key), " " );
396396 }
397- return int (attr.size ());
397+ return attribs;
398+ }
399+
400+
401+ /* * Parses a sequence of key-value pairs of the form KEY=VALUE or KEY="VALUE".
402+ * If parameter 'requireValues' is false, attributes may also consist of a key only.
403+ * @param[out] attribs the scanned attributes
404+ * @param[in] requireValues true if all attributes require a value
405+ * @param[in] quotechars recognized quote characters used to enclose the attribute values
406+ * @return number of attributes scanned */
407+ int InputReader::parseAttributes (map<string,string> &attribs, bool requireValues, const char *quotechars) {
408+ attribs = parseAttributes (requireValues, quotechars);
409+ return int (attribs.size ());
398410}
399411
400412// ////////////////////////////////////////
@@ -424,4 +436,4 @@ streamsize BufferInputReader::read (char *buf, streamsize size) {
424436 while (c >= 0 && size-- > 0 )
425437 *p++ = char (c);
426438 return p-buf;
427- }
439+ }
0 commit comments