firemail
标题:
基于接口的开发
[打印本页]
作者:
hechengjin
时间:
2016-3-27 23:31
标题:
基于接口的开发
interface nsIPop3URL : nsISupports {
attribute nsIPop3Sink pop3Sink;
attribute string messageUri;
/// Constant for the default POP3 port number
const int32_t DEFAULT_POP3_PORT = 110;
/// Constant for the default POP3 over ssl port number
const int32_t DEFAULT_POP3S_PORT = 995;
};
//关于类似pop3Sink属性的说明:
//js中可直接调用A.pop2Sink 而C++中对应的是SetPop3Sink(nsIPop3Sink* aPop3Sink) 和 GetPop3Sink(nsIPop3Sink** aPop3Sink)
nsCOMPtr<nsIPop3URL> pop3Url = do_CreateInstance(kPop3UrlCID, &rv);
pop3Url->SetPop3Sink(pop3Sink);
如上代码如果不知道是创建的哪个类的实例可通过其接口nsIPop3URL属性对应的方法SetPop3Sink进行查找,看哪个类实现了这个方法
nsPop3URL.cpp
nsresult nsPop3URL::SetPop3Sink(nsIPop3Sink* aPop3Sink)
进一步查找该类实现的接口
class nsPop3URL : public nsIPop3URL, public nsMsgMailNewsUrl
class NS_MSG_BASE nsMsgMailNewsUrl : public nsIMsgMailNewsUrl
interface nsIMsgMailNewsUrl : nsIURL
interface nsIURL : nsIURI
interface nsIURI : nsISupports
interface nsISupports {
void QueryInterface(in nsIIDRef uuid,
[iid_is(uuid),retval] out nsQIResult result);
[noscript, notxpcom] nsrefcnt AddRef();
[noscript, notxpcom] nsrefcnt Release();
};
复制代码
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3