mirror of https://github.com/AxioDL/boo.git
HIDParser: Use emplace() instead of insert()
Same thing, but shorter.
This commit is contained in:
parent
c8bebc9948
commit
a3a9b1ada7
|
@ -465,13 +465,13 @@ HIDParser::ParserStatus HIDParser::Parse(const PHIDP_PREPARSED_DATA descriptorDa
|
||||||
if (buttonCaps.IsRange) {
|
if (buttonCaps.IsRange) {
|
||||||
int usage = buttonCaps.Range.UsageMin;
|
int usage = buttonCaps.Range.UsageMin;
|
||||||
for (int i = buttonCaps.Range.DataIndexMin; i <= buttonCaps.Range.DataIndexMax; ++i, ++usage) {
|
for (int i = buttonCaps.Range.DataIndexMin; i <= buttonCaps.Range.DataIndexMax; ++i, ++usage) {
|
||||||
inputItems.insert(std::make_pair(i, HIDMainItem(buttonCaps.BitField, HIDUsagePage(buttonCaps.UsagePage),
|
inputItems.emplace(i, HIDMainItem(buttonCaps.BitField, HIDUsagePage(buttonCaps.UsagePage), HIDUsage(usage),
|
||||||
HIDUsage(usage), std::make_pair(0, 1), 1)));
|
std::make_pair(0, 1), 1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inputItems.insert(std::make_pair(buttonCaps.NotRange.DataIndex,
|
inputItems.emplace(buttonCaps.NotRange.DataIndex,
|
||||||
HIDMainItem(buttonCaps.BitField, HIDUsagePage(buttonCaps.UsagePage),
|
HIDMainItem(buttonCaps.BitField, HIDUsagePage(buttonCaps.UsagePage),
|
||||||
HIDUsage(buttonCaps.NotRange.Usage), std::make_pair(0, 1), 1)));
|
HIDUsage(buttonCaps.NotRange.Usage), std::make_pair(0, 1), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,15 +485,15 @@ HIDParser::ParserStatus HIDParser::Parse(const PHIDP_PREPARSED_DATA descriptorDa
|
||||||
if (valueCaps.IsRange) {
|
if (valueCaps.IsRange) {
|
||||||
int usage = valueCaps.Range.UsageMin;
|
int usage = valueCaps.Range.UsageMin;
|
||||||
for (int i = valueCaps.Range.DataIndexMin; i <= valueCaps.Range.DataIndexMax; ++i, ++usage) {
|
for (int i = valueCaps.Range.DataIndexMin; i <= valueCaps.Range.DataIndexMax; ++i, ++usage) {
|
||||||
inputItems.insert(std::make_pair(
|
inputItems.emplace(i, HIDMainItem(valueCaps.BitField, HIDUsagePage(valueCaps.UsagePage), HIDUsage(usage),
|
||||||
i, HIDMainItem(valueCaps.BitField, HIDUsagePage(valueCaps.UsagePage), HIDUsage(usage),
|
std::make_pair(valueCaps.LogicalMin, valueCaps.LogicalMax),
|
||||||
std::make_pair(valueCaps.LogicalMin, valueCaps.LogicalMax), valueCaps.BitSize)));
|
valueCaps.BitSize));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inputItems.insert(std::make_pair(
|
inputItems.emplace(valueCaps.NotRange.DataIndex,
|
||||||
valueCaps.NotRange.DataIndex,
|
HIDMainItem(valueCaps.BitField, HIDUsagePage(valueCaps.UsagePage),
|
||||||
HIDMainItem(valueCaps.BitField, HIDUsagePage(valueCaps.UsagePage), HIDUsage(valueCaps.NotRange.Usage),
|
HIDUsage(valueCaps.NotRange.Usage),
|
||||||
HIDRange(valueCaps.LogicalMin, valueCaps.LogicalMax), valueCaps.BitSize)));
|
HIDRange(valueCaps.LogicalMin, valueCaps.LogicalMax), valueCaps.BitSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue