IT翻訳 Nobuyuki の仕事部屋

ボランティアでソフトウエアーローカライズのために翻訳をしている。

Mozilla DOM Hacking Guide: Introduction to XPCOM21

2006-01-30 23:25:52 | InDraft
今日でタイトルの文書は最終回。
プログラマでない私が、プログラムの勉強を続けながら Mozilla Org. の文書を翻訳させてもらっている。一人よがりの翻訳にならないように、ご意見や、ダメ出しを含めたアドバイス大歓迎。

翻訳対象文書が、オープンソースの開発関連文書という一般向けするものではないので、それほど多くの人に読んではもらえない。しかし、翻訳を続けながら今のところ、このブログも出来る限り継続したいと思う。少しでも、上達したいと思う限り修行は続く。 m(__)m

てなわけで本日は、草稿として最後の部分の仕上をする。
-------------------------------------------------------------------

To illustrate the inherited implementation of an interface, let's take a look at the real class that implements the HTML Anchor Element. It is nsHTMLAnchorElement. We can see that the inheritance chain for the real classes looks like this:

nsGenericElement -> nsGenericHTMLElement -> nsGenericHTMLContainerElement -> nsHTMLAnchorElement


インターフェイスが継承された時の実装を解説するのに、HTML Anchor Element を実装している実際のクラスを見てみましょう。調べるのは nsHTMLAnchorElement です。実際のクラスの継承の連鎖はこのようになっています:

nsGenericElement -> nsGenericHTMLElement -> nsGenericHTMLContainerElement -> nsHTMLAnchorElement


We can see this in the class definitions:

class nsHTMLAnchorElement : public nsGenericHTMLContainerElement
class nsGenericHTMLContainerElement : public nsGnericHTMLElement
class nsGenericHTMLElement : public nsGenericElement


クラスの定義は以下のようになっています:

class nsHTMLAnchorElement : public nsGenericHTMLContainerElement
class nsGenericHTMLContainerElement : public nsGnericHTMLElement
class nsGenericHTMLElement : public nsGenericElement


Looking at the class definitions, we can see that nsGenericHTMLElement and nsGenericHTMLContainerElement don't implement any interface directly. However nsGenericElement does:

class nsGenericElement : public nsIHTMLContent


クラスの定義を見ると、nsGenericHTMLElement と nsGenericHTMLContainerElement 直接インターフェイスを実装していません。しかし、nsGenericElement は実装しています:

class nsGenericElement : public nsIHTMLContent


This of course means that nsGenericElement implements the nsIHTMLContent interface. The interface inheritance chain for nsIHTMLContent looks like this:

nsISupports -> nsIContent -> nsIStyledContent -> nsIXMLContent -> nsIHTMLContent


これはもちろん nsGenericElement が nsIHTMLContent インターフェイスを実装していることになります。 nsIHTMLContent への継承の連鎖は以下のようになります:

nsISupports -> nsIContent -> nsIStyledContent -> nsIXMLContent -> nsIHTMLContent


nsGenericElement has to implement all of the above interfaces, and all the real classes inheriting from nsGenericElement will automatically implement all those interfaces. This is consistent with the rules we have defined earlier in this paragraph.


nsGenericElement は上記のすべてのインターフェイスを実装しなくてはなりません。そして、nsGenericElement を継承するすべての実際のクラスは自動的にこれらのインターフェイスを実装します。 この事はすでにこの段落で定義した規則と一致しています。


Resources of interest:
The XPIDL reference
Mapping DOM Objects to their C++ class
Modularization techniques


関連する参照先:
xpidl コンパイラ
Mapping DOM Objects to their C++ class
モジュール化の方法


この文書はMozilla Japan Org. で草稿公開されることになります。

m(__)mm(__)mm(__)mm(__)mm(__)mm(__)mm(__)mm(__)mm(__)mm(__)m