[新闻] dxpcom v0.1 发布

qiezi 2007-05-05
qiezi 写道
目前正在进行中的例子:

module test2;

import mozilla.xpcom.nsXPCOM;
import mozilla.dxpcom.nsXPCOM;
import mozilla.dxpcom.nsILocalFileD;
import mozilla.dxpcom.nsIComponentManagerD;
import std.string;
import std.stdio;

static this() {
	NS_InitXPCOM2(null, null, null);
}

static ~this() {
	ShutdownXPCOM(null);
}

void main(char[][] args)
{
	nsIComponentManagerD componentManager = GetComponentManager();

	nsILocalFileD ifiled = componentManager.CreateInstanceByContractID!(nsILocalFileD)(
		"@mozilla.org/file/local;1", null);

	ifiled.InitWithPath("/home/lijie/dprojects/dxpcom/samples/test2.d"w);

	writefln("GetFileSize result: %d", ifiled.FileSize);
}

可以看到代码非常少,static this和static ~this可以放到nsXPCOM里面,所以实际上代码会更少一些。


已经实现了。
samples/filesize2.d

module test2;

import mozilla.xpcom.nsXPCOM;
import mozilla.dxpcom.nsXPCOM;
import mozilla.dxpcom.nsIComponentManagerD;
import mozilla.dxpcom.StringAPI;
import mozilla.dxpcom.nsILocalFileD;
import std.string;
import std.stdio;

static this() {
    NS_InitXPCOM2(null, null, null);
}

static ~this() {
    ShutdownXPCOM(null);
}

void main(char[][] args) {
    if (args.length < 2) {
        writefln("USAGE: %s files...", args[0]);
        return;
    }

    scope nsIComponentManagerD componentManager = GetComponentManager();
    scope auto ifiled = componentManager.CreateInstanceByContractId!(nsILocalFileD)(
        "@mozilla.org/file/local;1", null);

    foreach(file; args[1..$]) {
        ifiled.InitWithPath(std.utf.toUTF16(file));
        writefln("File %s size: %d", file, ifiled.FileSize);
    }
}

执行:
引用

./filesize2 ~/dprojects/dxpcom/idl/*
File /home/lijie/dprojects/dxpcom/idl/domstubs.idl size: 3912
File /home/lijie/dprojects/dxpcom/idl/genimp.rb size: 316
File /home/lijie/dprojects/dxpcom/idl/gen.rb size: 327
File /home/lijie/dprojects/dxpcom/idl/mozIJSSubScriptLoader.idl size: 2541
File /home/lijie/dprojects/dxpcom/idl/nsIASN1Object.idl size: 4010
File /home/lijie/dprojects/dxpcom/idl/nsIASN1Sequence.idl size: 3487
File /home/lijie/dprojects/dxpcom/idl/nsIBadCertListener.idl size: 6925
File /home/lijie/dprojects/dxpcom/idl/nsICategoryManager.idl size: 3872
File /home/lijie/dprojects/dxpcom/idl/nsICertificateDialogs.idl size: 5003
File /home/lijie/dprojects/dxpcom/idl/nsIChannel.idl size: 9559
File /home/lijie/dprojects/dxpcom/idl/nsIClassInfo.idl size: 5057
File /home/lijie/dprojects/dxpcom/idl/nsIClipboardCommands.idl size: 4414
File /home/lijie/dprojects/dxpcom/idl/nsIComponentManager.idl size: 3977
File /home/lijie/dprojects/dxpcom/idl/nsIComponentRegistrar.idl size: 8790
File /home/lijie/dprojects/dxpcom/idl/nsIContextMenuListener.idl size: 4225
File /home/lijie/dprojects/dxpcom/idl/nsICookie.idl size: 4482
File /home/lijie/dprojects/dxpcom/idl/nsICookieManager.idl size: 2741
File /home/lijie/dprojects/dxpcom/idl/nsICRLInfo.idl size: 3020
File /home/lijie/dprojects/dxpcom/idl/nsIDebug.idl size: 2372
File /home/lijie/dprojects/dxpcom/idl/nsIDirectoryService.idl size: 4378
File /home/lijie/dprojects/dxpcom/idl/nsIDOM3DocumentEvent.idl size: 2315
File /home/lijie/dprojects/dxpcom/idl/nsIDOM3EventTarget.idl size: 3063
File /home/lijie/dprojects/dxpcom/idl/nsIDOMAbstractView.idl size: 2247
File /home/lijie/dprojects/dxpcom/idl/nsIDOMAttr.idl size: 2628
File /home/lijie/dprojects/dxpcom/idl/nsIDOMBarProp.idl size: 2257
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCDATASection.idl size: 2388
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCharacterData.idl size: 3430
File /home/lijie/dprojects/dxpcom/idl/nsIDOMComment.idl size: 2340
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCSSPrimitiveValue.idl size: 4875
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCSSRule.idl size: 2981
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCSSRuleList.idl size: 2347
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCSSStyleDeclaration.idl size: 3096
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCSSStyleSheet.idl size: 2647
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCSSValue.idl size: 2637
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCSSValueList.idl size: 2242
File /home/lijie/dprojects/dxpcom/idl/nsIDOMCustomEvent.idl size: 2360
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDocumentEvent.idl size: 2383
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDocumentFragment.idl size: 2342
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDocument.idl size: 4725
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDocumentRange.idl size: 2281
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDocumentStyle.idl size: 2331
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDocumentType.idl size: 2703
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDocumentView.idl size: 2275
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDOMException.idl size: 3867
File /home/lijie/dprojects/dxpcom/idl/nsIDOMDOMImplementation.idl size: 2995
File /home/lijie/dprojects/dxpcom/idl/nsIDOMElementCSSInlineStyle.idl size: 2271
File /home/lijie/dprojects/dxpcom/idl/nsIDOMElement.idl size: 4378
File /home/lijie/dprojects/dxpcom/idl/nsIDOMEntity.idl size: 2404
File /home/lijie/dprojects/dxpcom/idl/nsIDOMEntityReference.idl size: 2275
File /home/lijie/dprojects/dxpcom/idl/nsIDOMEventGroup.idl size: 2291
File /home/lijie/dprojects/dxpcom/idl/nsIDOMEvent.idl size: 7191
File /home/lijie/dprojects/dxpcom/idl/nsIDOMEventListener.idl size: 2736
File /home/lijie/dprojects/dxpcom/idl/nsIDOMEventTarget.idl size: 6461
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLAnchorElement.idl size: 2864
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLAppletElement.idl size: 2839
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLAreaElement.idl size: 2610
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLBaseElement.idl size: 2333
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLBaseFontElement.idl size: 2418
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLBodyElement.idl size: 2518
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLBRElement.idl size: 2282
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLButtonElement.idl size: 2803
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLCollection.idl size: 2398
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLDirectoryElement.idl size: 2299
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLDivElement.idl size: 2285
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLDListElement.idl size: 2290
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLDocument.idl size: 3617
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLElement.idl size: 2512
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLEmbedElement.idl size: 2499
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLFieldSetElement.idl size: 2305
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLFontElement.idl size: 2376
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLFormElement.idl size: 2726
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLFrameElement.idl size: 2719
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLFrameSetElement.idl size: 2343
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLHeadElement.idl size: 2290
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLHeadingElement.idl size: 2305
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLHRElement.idl size: 2418
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLHtmlElement.idl size: 2290
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLIFrameElement.idl size: 2810
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLImageElement.idl size: 2907
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLInputElement.idl size: 3383
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLIsIndexElement.idl size: 2352
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLLabelElement.idl size: 2401
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLLegendElement.idl size: 2402
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLLIElement.idl size: 2332
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLLinkElement.idl size: 2651
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLMapElement.idl size: 2337
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLMenuElement.idl size: 2290
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLMetaElement.idl size: 2429
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLModElement.idl size: 2340
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLObjectElement.idl size: 3256
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLOListElement.idl size: 2379
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLOptGroupElement.idl size: 2348
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLOptionElement.idl size: 2723
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLOptionsCollection.idl size: 2458
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLParagraphElement.idl size: 2295
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLParamElement.idl size: 2428
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLPreElement.idl size: 2285
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLQuoteElement.idl size: 2286
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLScriptElement.idl size: 2564
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLSelectElement.idl size: 3328
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLStyleElement.idl size: 2383
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLTableCaptionElem.idl size: 2307
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLTableCellElement.idl size: 2936
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLTableColElement.idl size: 2517
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLTableElement.idl size: 3973
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLTableRowElement.idl size: 3050
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLTableSectionElem.idl size: 2824
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLTextAreaElement.idl size: 2961
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLTitleElement.idl size: 2290
File /home/lijie/dprojects/dxpcom/idl/nsIDOMHTMLUListElement.idl size: 2334
File /home/lijie/dprojects/dxpcom/idl/nsIDOMMediaList.idl size: 2704
File /home/lijie/dprojects/dxpcom/idl/nsIDOMMouseEvent.idl size: 3754
File /home/lijie/dprojects/dxpcom/idl/nsIDOMNamedNodeMap.idl size: 3232
File /home/lijie/dprojects/dxpcom/idl/nsIDOMNode.idl size: 5028
File /home/lijie/dprojects/dxpcom/idl/nsIDOMNodeList.idl size: 2499
File /home/lijie/dprojects/dxpcom/idl/nsIDOMNotation.idl size: 2464
File /home/lijie/dprojects/dxpcom/idl/nsIDOMNSDocumentStyle.idl size: 2734
File /home/lijie/dprojects/dxpcom/idl/nsIDOMProcessingInstruction.idl size: 2495
File /home/lijie/dprojects/dxpcom/idl/nsIDOMRange.idl size: 5554
File /home/lijie/dprojects/dxpcom/idl/nsIDOMStorageEvent.idl size: 2834
File /home/lijie/dprojects/dxpcom/idl/nsIDOMStorage.idl size: 3609
File /home/lijie/dprojects/dxpcom/idl/nsIDOMStorageItem.idl size: 2308
File /home/lijie/dprojects/dxpcom/idl/nsIDOMStorageList.idl size: 2355
File /home/lijie/dprojects/dxpcom/idl/nsIDOMStorageWindow.idl size: 2396
File /home/lijie/dprojects/dxpcom/idl/nsIDOMStyleSheet.idl size: 2567
File /home/lijie/dprojects/dxpcom/idl/nsIDOMStyleSheetList.idl size: 2352
File /home/lijie/dprojects/dxpcom/idl/nsIDOMText.idl size: 2436
File /home/lijie/dprojects/dxpcom/idl/nsIDOMUIEvent.idl size: 2651
File /home/lijie/dprojects/dxpcom/idl/nsIDOMWindow2.idl size: 2152
File /home/lijie/dprojects/dxpcom/idl/nsIDOMWindowCollection.idl size: 2536
File /home/lijie/dprojects/dxpcom/idl/nsIDOMWindow.idl size: 5436
File /home/lijie/dprojects/dxpcom/idl/nsIDOMWindowUtils.idl size: 3399
File /home/lijie/dprojects/dxpcom/idl/nsIEmbeddingSiteWindow.idl size: 5747
File /home/lijie/dprojects/dxpcom/idl/nsIFactory.idl size: 3509
File /home/lijie/dprojects/dxpcom/idl/nsIFile.idl size: 12696
File /home/lijie/dprojects/dxpcom/idl/nsIFileURL.idl size: 2699
File /home/lijie/dprojects/dxpcom/idl/nsIGlobalHistory.idl size: 2677
File /home/lijie/dprojects/dxpcom/idl/nsIHistoryEntry.idl size: 3570
File /home/lijie/dprojects/dxpcom/idl/nsIHttpChannel.idl size: 11856
File /home/lijie/dprojects/dxpcom/idl/nsIHttpHeaderVisitor.idl size: 2428
File /home/lijie/dprojects/dxpcom/idl/nsIInputStream.idl size: 5661
File /home/lijie/dprojects/dxpcom/idl/nsIInterfaceRequestor.idl size: 3155
File /home/lijie/dprojects/dxpcom/idl/nsIIOService.idl size: 7540
File /home/lijie/dprojects/dxpcom/idl/nsILoadGroup.idl size: 4034
File /home/lijie/dprojects/dxpcom/idl/nsILocalFile.idl size: 6420
File /home/lijie/dprojects/dxpcom/idl/nsIMemory.idl size: 5180
File /home/lijie/dprojects/dxpcom/idl/nsIModule.idl size: 4424
File /home/lijie/dprojects/dxpcom/idl/nsIObserver.idl size: 2842
File /home/lijie/dprojects/dxpcom/idl/nsIObserverService.idl size: 4102
File /home/lijie/dprojects/dxpcom/idl/nsIOutputStream.idl size: 6941
File /home/lijie/dprojects/dxpcom/idl/nsIPrefBranch2.idl size: 5054
File /home/lijie/dprojects/dxpcom/idl/nsIPrefBranch.idl size: 13027
File /home/lijie/dprojects/dxpcom/idl/nsIPrefLocalizedString.idl size: 4235
File /home/lijie/dprojects/dxpcom/idl/nsIPrefService.idl size: 7460
File /home/lijie/dprojects/dxpcom/idl/nsIProfileChangeStatus.idl size: 5663
File /home/lijie/dprojects/dxpcom/idl/nsIProfile.idl size: 3597
File /home/lijie/dprojects/dxpcom/idl/nsIProgrammingLanguage.idl size: 2608
File /home/lijie/dprojects/dxpcom/idl/nsIPromptService.idl size: 15617
File /home/lijie/dprojects/dxpcom/idl/nsIProperties.idl size: 2875
File /home/lijie/dprojects/dxpcom/idl/nsIProtocolHandler.idl size: 6920
File /home/lijie/dprojects/dxpcom/idl/nsIRequest.idl size: 8115
File /home/lijie/dprojects/dxpcom/idl/nsIRequestObserver.idl size: 2925
File /home/lijie/dprojects/dxpcom/idl/nsIScriptableInputStream.idl size: 2847
File /home/lijie/dprojects/dxpcom/idl/nsISecurityWarningDialogs.idl size: 4256
File /home/lijie/dprojects/dxpcom/idl/nsISelection.idl size: 5821
File /home/lijie/dprojects/dxpcom/idl/nsIServiceManager.idl size: 4309
File /home/lijie/dprojects/dxpcom/idl/nsISHistory.idl size: 7303
File /home/lijie/dprojects/dxpcom/idl/nsISHistoryListener.idl size: 8580
File /home/lijie/dprojects/dxpcom/idl/nsISimpleEnumerator.idl size: 3483
File /home/lijie/dprojects/dxpcom/idl/nsIStreamListener.idl size: 3276
File /home/lijie/dprojects/dxpcom/idl/nsISupports.idl size: 2709
File /home/lijie/dprojects/dxpcom/idl/nsISupportsPrimitives.idl size: 7366
File /home/lijie/dprojects/dxpcom/idl/nsITooltipListener.idl size: 3184
File /home/lijie/dprojects/dxpcom/idl/nsITooltipTextProvider.idl size: 3074
File /home/lijie/dprojects/dxpcom/idl/nsITraceRefcnt.idl size: 2667
File /home/lijie/dprojects/dxpcom/idl/nsIUnicharStreamListener.idl size: 2748
File /home/lijie/dprojects/dxpcom/idl/nsIUploadChannel.idl size: 3958
File /home/lijie/dprojects/dxpcom/idl/nsIURIContentListener.idl size: 7820
File /home/lijie/dprojects/dxpcom/idl/nsIURI.idl size: 8277
File /home/lijie/dprojects/dxpcom/idl/nsIURL.idl size: 7167
File /home/lijie/dprojects/dxpcom/idl/nsIWeakReference.idl size: 3940
File /home/lijie/dprojects/dxpcom/idl/nsIWebBrowserChromeFocus.idl size: 2393
File /home/lijie/dprojects/dxpcom/idl/nsIWebBrowserChrome.idl size: 6292
File /home/lijie/dprojects/dxpcom/idl/nsIWebBrowserFind.idl size: 5682
File /home/lijie/dprojects/dxpcom/idl/nsIWebBrowserFocus.idl size: 4193
File /home/lijie/dprojects/dxpcom/idl/nsIWebBrowser.idl size: 7447
File /home/lijie/dprojects/dxpcom/idl/nsIWebBrowserPrint.idl size: 6332
File /home/lijie/dprojects/dxpcom/idl/nsIWebBrowserSetup.idl size: 4736
File /home/lijie/dprojects/dxpcom/idl/nsIWebBrowserStream.idl size: 3635
File /home/lijie/dprojects/dxpcom/idl/nsIWebProgress.idl size: 6503
File /home/lijie/dprojects/dxpcom/idl/nsIWebProgressListener.idl size: 16137
File /home/lijie/dprojects/dxpcom/idl/nsIWindowCreator.idl size: 3081
File /home/lijie/dprojects/dxpcom/idl/nsIWindowWatcher.idl size: 9033
File /home/lijie/dprojects/dxpcom/idl/nsIX509CertDB.idl size: 11300
File /home/lijie/dprojects/dxpcom/idl/nsIX509Cert.idl size: 8680
File /home/lijie/dprojects/dxpcom/idl/nsIX509CertValidity.idl size: 3500
File /home/lijie/dprojects/dxpcom/idl/nsrootidl.idl size: 4509
h_rain 2007-05-05
哈哈,太棒了!干得好~

我在最新的xulrunner-1.9a5pre中看到,MozillaInterfaces-src.jar文件里面,就有所有的1300多供java使用的xpcom接口。

偏偏那个SDK里面不提供全部的idl,真奇怪。
qiezi 2007-05-05
不知道为什么。。那1300多个有些涉及到内部使用的类型,这个有些不爽。就不知道简单包装成接口类型么
qiezi 2007-05-05
由于数组类型没有处理,现有的使用array的接口编译无法通过,有几十个接口受影响,这个是0.2版的最后任务,有点麻烦。

五一刚好赶上台球赛,每天看到很晚,白天手痒出去学台球了,也就没什么时间来写代码,实际上如果能抽出时间的话,前面这些一天就做完了。
h_rain 2007-05-06
qiezi我倒~你的台球打的如何?
对了,如果基于java的接口源码进行文本替换,是否能够转换的容易些啊?
qiezi 2007-05-06
台球打得烂。。以前在网上打,真实的才学没多久,打着玩玩。。。

基于java转换没什么好处,java版本的也不是很好,没有达到我想要的样子。另外它也只完成了形式转换,我现在还需要处理转调用,比它麻烦很多。

现在包装类的析构函数里已经调用了Release,所以代码看起来很简洁了~
h_rain 2007-05-06
:)

哦.
qiezi 2007-05-06
124个受影响的接口:
gfxIImageFrame.idl
imgIEncoder.idl
ipcIMessageObserver.idl
ipcIService.idl
ipcITransactionObserver.idl
ipcITransactionService.idl
jsdIDebuggerService.idl
mozIStorageStatement.idl
mozIStorageValueArray.idl
nsIAbBooleanExpression.idl
nsIAbDirectory.idl
nsIAbDirectoryQuery.idl
nsIAbLDAPAttributeMap.idl
nsIAbLDAPDirectory.idl
nsIAccessibleTable.idl
nsIAnnotationService.idl
nsIArray.idl
nsIASN1Sequence.idl
nsIAutoCompleteSimpleResult.idl
nsIBinaryInputStream.idl
nsIBinaryOutputStream.idl
nsIBookmarkTransactionManager.idl
nsICertPickDialogs.idl
nsICertSelect.idl
nsIClassInfo.idl
nsIClientAuthDialogs.idl
nsICmdLineService.idl
nsICMSMessage2.idl
nsICollation.idl
nsIComm4xProfile.idl
nsICommandLineHandler.idl
nsICommandLine.idl
nsIConsoleService.idl
nsIContentSniffer.idl
nsICRLManager.idl
nsICryptoHash.idl
nsIDOMParser.idl
nsIDOMWindowInternal.idl
nsIDragService.idl
nsIEditorSpellCheck.idl
nsIExpatSink.idl
nsIFaviconService.idl
nsIFeed.idl
nsIFontEnumerator.idl
nsIFormSigningDialog.idl
nsIGenericInterfaceInfoSet.idl
nsIHTMLEditor.idl
nsIImportAddressBooks.idl
nsIImportMail.idl
nsIInlineSpellChecker.idl
nsIInterfaceInfoToIDL.idl
nsIKeyModule.idl
nsILDAPAutoCompFormatter.idl
nsILDAPAutoCompleteSession.idl
nsILDAPBERValue.idl
nsILDAPMessage.idl
nsILDAPOperation.idl
nsILDAPPrefsService.idl
nsILDAPURL.idl
nsIMessenger.idl
nsIMetricsService.idl
nsIMIMEInfo.idl
nsIMsgAccount.idl
nsIMsgAccountManager.idl
nsIMsgDatabase.idl
nsIMsgDBView.idl
nsIMsgFilter.idl
nsIMsgFilterList.idl
nsIMsgFilterPlugin.idl
nsIMsgFolder.idl
nsIMsgHeaderParser.idl
nsIMsgImapMailFolder.idl
nsIMsgMailView.idl
nsIMsgSearchTerm.idl
nsIMsgSearchValidityTable.idl
nsIMsgTagService.idl
nsINavBookmarksService.idl
nsINavHistoryService.idl
nsIPluginHost.idl
nsIPluginManager.idl
nsIPluginTagInfo2.idl
nsIPluginTagInfo.idl
nsIPop3Protocol.idl
nsIPrefBranch.idl
nsIPref.idl
nsIPrintOptions.idl
nsIProcess.idl
nsIProfile.idl
nsIProfileInternal.idl
nsIPrompt.idl
nsIPromptService.idl
nsIProperties.idl
nsIRegistry.idl
nsISchema.idl
nsIScriptableUConv.idl
nsIScriptEventHandler.idl
nsIScriptEventManager.idl
nsISelection2.idl
nsISMimeJSHelper.idl
nsISmtpService.idl
nsISOAPMessage.idl
nsISocketTransportService.idl
nsIStreamCipher.idl
nsIStreamLoader.idl
nsIStringBundle.idl
nsIStringStream.idl
nsISubscribableServer.idl
nsISupportsArray.idl
nsISVGGeometrySource.idl
nsISVGRendererSurface.idl
nsITokenDialogs.idl
nsIUnicharInputStream.idl
nsIUnicharOutputStream.idl
nsIUpdateService.idl
nsIWebBrowserPrint.idl
nsIWebBrowserStream.idl
nsIWebContentConverterRegistrar.idl
nsIWebDAVService.idl
nsIX509Cert3.idl
nsIX509CertDB.idl
nsIX509Cert.idl
nsIXPIDialogService.idl
nsIXPInstallManager.idl
nsIXTFElement.idl

IDL里面数组和数组长度顺序不定,有时候长度在前,有时候长度在后,所以要判断了。如果顺序固定倒是很简单的。
h_rain 2007-05-06
IDL里面数组和数组长度顺序不定,有时候长度在前,有时候长度在后,所以要判断了。如果顺序固定倒是很简单的。

真是狂晕~还能这样~
qiezi 2007-05-06
IDL数组参数设计得比较灵活,所以处理起来也费劲。

数组参数把长度单独指定的,这样倒是方便了C++:

void foo(..., unsinged long length, ..., [array, size_is(length)] nsISupports arr, ...);

void foo(..., [array, size_is(length)] nsISupports arr, ..., unsinged long length, ...);

这两种都是可以正确生成的,size_is指定长度参数。out参数也是一样,只是数组和长度参数同时为out。

现在转成D风格的,就要把长度参数去掉,数组参数改成D数组,数组元素类型也要转换:
void foo(..., nsISupportsD[] arr, ...);

代码转换并不复杂,就是函数签名转换麻烦点。
Global site tag (gtag.js) - Google Analytics