Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2077|回复: 0
打印 上一主题 下一主题

基于接口的开发

[复制链接]

388

主题

602

帖子

2218

积分

金牌会员

Rank: 6Rank: 6

积分
2218
跳转到指定楼层
楼主
发表于 2015-9-15 14:43:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. interface nsIPop3URL : nsISupports {
  2. attribute nsIPop3Sink pop3Sink;
  3. attribute string messageUri;

  4. /// Constant for the default POP3 port number
  5. const int32_t DEFAULT_POP3_PORT = 110;

  6. /// Constant for the default POP3 over ssl port number
  7. const int32_t DEFAULT_POP3S_PORT = 995;
  8. };

  9. //关于类似pop3Sink属性的说明:
  10. //js中可直接调用A.pop3Sink 而C++中对应的是SetPop3Sink(nsIPop3Sink* aPop3Sink) 和 GetPop3Sink(nsIPop3Sink** aPop3Sink)


  11. nsCOMPtr<nsIPop3URL> pop3Url = do_CreateInstance(kPop3UrlCID, &rv);
  12. pop3Url->SetPop3Sink(pop3Sink);

  13. 如上代码如果不知道是创建的哪个类的实例可通过其接口nsIPop3URL属性对应的方法SetPop3Sink进行查找,看哪个类实现了这个方法
  14. nsPop3URL.cpp
  15. nsresult nsPop3URL::SetPop3Sink(nsIPop3Sink* aPop3Sink)
  16. 进一步查找该类实现的接口
  17. class nsPop3URL : public nsIPop3URL, public nsMsgMailNewsUrl
  18. class NS_MSG_BASE nsMsgMailNewsUrl : public nsIMsgMailNewsUrl
  19. interface nsIMsgMailNewsUrl : nsIURL
  20. interface nsIURL : nsIURI
  21. interface nsIURI : nsISupports
  22. interface nsISupports {
  23. void QueryInterface(in nsIIDRef uuid,
  24. [iid_is(uuid),retval] out nsQIResult result);
  25. [noscript, notxpcom] nsrefcnt AddRef();
  26. [noscript, notxpcom] nsrefcnt Release();
  27. };
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-4-19 17:20 , Processed in 0.058344 second(s), 18 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表