MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / SplitChord

Method SplitChord

pcsx2/Input/InputManager.cpp:192–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190// ------------------------------------------------------------------------
191
192std::vector<std::string_view> InputManager::SplitChord(const std::string_view binding)
193{
194 std::vector<std::string_view> parts;
195
196 // under an if for RVO
197 if (!binding.empty())
198 {
199 std::string_view::size_type last = 0;
200 std::string_view::size_type next;
201 while ((next = binding.find('&', last)) != std::string_view::npos)
202 {
203 if (last != next)
204 {
205 std::string_view part(StringUtil::StripWhitespace(binding.substr(last, next - last)));
206 if (!part.empty())
207 parts.push_back(std::move(part));
208 }
209 last = next + 1;
210 }
211 if (last < (binding.size() - 1))
212 {
213 std::string_view part(StringUtil::StripWhitespace(binding.substr(last)));
214 if (!part.empty())
215 parts.push_back(std::move(part));
216 }
217 }
218
219 return parts;
220}
221
222bool InputManager::SplitBinding(const std::string_view binding, std::string_view* source, std::string_view* sub_binding)
223{

Callers

nothing calls this directly

Calls 6

StripWhitespaceFunction · 0.85
substrMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected