MCPcopy Create free account
hub / github.com/SFML/SFML / getDeviceString

Function getDeviceString

src/SFML/Window/macOS/JoystickImpl.cpp:53–65  ·  view source on GitHub ↗

Get HID device property key as a string

Source from the content-addressed store, hash-verified

51
52// Get HID device property key as a string
53std::string getDeviceString(IOHIDDeviceRef ref, CFStringRef prop, unsigned int index)
54{
55 CFTypeRef typeRef = IOHIDDeviceGetProperty(ref, prop);
56 if (typeRef && (CFGetTypeID(typeRef) == CFStringGetTypeID()))
57 {
58 const auto* str = static_cast<CFStringRef>(typeRef);
59 return stringFromCFString(str);
60 }
61
62 sf::err() << "Unable to read string value for property '" << stringFromCFString(prop) << "' for joystick at index "
63 << index << std::endl;
64 return "Unknown Joystick";
65}
66
67
68// Get HID device property key as an unsigned int

Callers 1

openMethod · 0.85

Calls 1

stringFromCFStringFunction · 0.85

Tested by

no test coverage detected