QPluginParsedMetaData: avoid the indirection through QCborMap

value[x] is the same as value.toMap()[x] but avoids the refcounting up
and down just to call the operator[] overload. We're calling the
operator[] overload taking an integer, which means it could match an
array, but we know the data member won't be one because of how
QPluginParsedMetaData::parse() parses.

Change-Id: I2cffe62afda945079b63fffd16bd5c690b2bfee4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2021-12-03 13:37:25 -08:00
parent ea0e0a8652
commit a1b2c474fd

View File

@ -90,7 +90,7 @@ public:
// if data is not a map, toMap() returns empty, so shall these functions
QCborMap toCbor() const { return data.toMap(); }
QCborValue value(QtPluginMetaDataKeys k) const { return toCbor()[int(k)]; }
QCborValue value(QtPluginMetaDataKeys k) const { return data[int(k)]; }
};
class QFactoryLoaderPrivate;