firemail

标题: 基于接口的开发 [打印本页]

作者: hechengjin    时间: 2015-9-15 14:43
标题: 基于接口的开发
  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. };
复制代码





欢迎光临 firemail (http://firemail.wang:8088/) Powered by Discuz! X3