ATL/COM 中的 IDL:我可以发布复杂类型的 const 吗?
我知道如何在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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
).