从 CFDictionary 获取数字以用于计算,iPhone

发布于 2024-08-20 07:37:21 字数 494 浏览 4 评论 0原文

我在旅行中发现了这个:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘦怹 2024-08-27 07:37:21

一旦您知道存储这些值的实际字典在哪里,您就可以使用以下调用访问字典中的值:

CFDictionaryGetValue (
   CFDictionaryRef theDict,
   const void *key
);

进一步检查目录 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:

CFDictionaryGetValue (
   CFDictionaryRef theDict,
   const void *key
);

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文