从 CFDictionary 获取数字以用于计算,iPhone
我在旅行中发现了这个:
http:// /www.opensource.apple.com/source/IOKitUser/IOKitUser-502/ps.subproj/IOPSKeys.h
我如何获取以下值(作为数字):
#define kIOPSMaxCapacityKey "Max Capacity"
并且
#define kIOPSDesignCapacityKey "DesignCapacity"
我希望能够使用它们在我的整个应用程序中。我需要向我的项目添加什么以及如何提取数字?
非常感谢,
斯图尔特
I found this in my travels:
http://www.opensource.apple.com/source/IOKitUser/IOKitUser-502/ps.subproj/IOPSKeys.h
How would I get the values (as a number) of:
#define kIOPSMaxCapacityKey "Max Capacity"
and
#define kIOPSDesignCapacityKey "DesignCapacity"
I want to be able to use them throughout my app. What do I need to add to my project and how do extract the numbers?
Many thanks,
Stuart
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一旦您知道存储这些值的实际字典在哪里,您就可以使用以下调用访问字典中的值:
进一步检查目录 http://www.opensource.apple.com/source/IOKitUser/IOKitUser-502/ps.subproj/ 可能允许您要弄清楚要调用哪些对象/方法来获取字典,并且类中的文档说明了它指向的内容(在前面提到的两个键中,它们指向 CFNumbers,因此在这种情况下 CFDictionaryGetValue 将返回一个 CFNumber。
Once you know where the actual dictionary is that it's storing these values, you can access the value from the dictionary using the following call:
Further examination of the directory http://www.opensource.apple.com/source/IOKitUser/IOKitUser-502/ps.subproj/ would probably allow you to figure out which objects/methods to call to get the dictionary, and the documentation within the class states what it points to (in your two previously mentioned keys, they point to CFNumbers, so in that case CFDictionaryGetValue will return a CFNumber.