ATL/COM 中的 IDL:我可以发布复杂类型的 const 吗?

发布于 2024-08-18 21:52:54 字数 388 浏览 2 评论 0原文

我知道如何在 IDL 中发布简单类型的 const,例如:

const long blah = 37

但我想发布复杂类型的 const,带有方法,或者至少是可读的类似结构的成员字段。例如,可能是一种名为 CarType 的类型,它具有“get_Make”、“get_Model”、“get_Year”、“get_BasePrice”等访问器字段。

然后我想发布const实例,例如FORD_PINTO_1973。

(请不要过多地阅读示例,告诉我这个特定的示例更适合没有 const 实例或类似内容的常规类)。

我不知道如何在 IDL 中定义 FORD_PINTO_1973 的年份字段为 1973 这一事实。

提前感谢您的帮助。

I know how to publish a const of a simple type in IDL, for example:

const long blah = 37

But I want to publish consts of complex types, with methods, or at least readable struct-like member fields. For example, perhaps a type called CarType, which has accessor fields like "get_Make", "get_Model", "get_Year", "get_BasePrice", et cetera.

Then I would like to publish const instances, such as FORD_PINTO_1973.

(Please don't read too much into the example, to tell me that this particular example would lend itself better to just regular classes without const instances or something like that).

I have no idea how I would define, in IDL, the fact that FORD_PINTO_1973 has a Year field of 1973.

Thanks in advance for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

风吹过旳痕迹 2024-08-25 21:52:54

IDL 用于定义接口——可以在对象上执行的操作的契约。真实对象的实现不在 IDL 之内。

为了提供只读属性,请提供 getter(使用 propget 属性),并且不提供 setter (propput)。

IDL is for defining interfaces - contracts of what can be done on an object. Real objects implementation is out of IDL.

In order to provide a read-only property provide a getter (use propget attribute) and don't provide the setter (propput).

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