使用注释

From Apache OpenOffice Wiki
Jump to: navigation, search


注释是 idlc 忽略的代码区域。在 UNOIDL 中,使用 C++ 风格的注释。双斜线 // 表示一行中其余的部分是注释。/**/ 之间的文字表示跨行的注释。

  service ImageShrink 
  {
      // the following lines define interfaces:
      interface org::openoffice::test::XImageShrink; // our home-grown interface
      interface com::sun::star::document::XFilter;
 
      /* we could reference other interfaces, services and properties here.
         However, the keywords uses and needs are deprecated
      */
  };


需要进一步说明的是,idl 文件使用 autodoc(UNOIDL 文档生成器)进行处理时,将提取文档注释。这时 /*// 被看作为纯文字注释标记,所以使用 /**/// 来创建文档注释。

  /** 请不要在其他行重复星号, 
    * <- 不要像这样使用
    */
 
  /// 不要用三斜线来标注多行的文档注释,
  /// 因为只有这最后一行会被读入作为文档注释


XUnoUrlResolver idl 示例文件中包含纯文字注释和文档注释。

  /** service <type scope="com::sun::star::bridge">UnoUrlResolver</type> 
      implements this interface.
   */
  interface XUnoUrlResolver: com::sun::star::uno::XInterface
  { 
      // method com::sun::star::bridge::XUnoUrlResolver::resolve
      /** resolves an object, on the UNO URL.
       */
 
      ...
  }


请注意,文档注释中附加的 <type/> 标记指出 UnoUrlResolver 服务将实现 XUnoUrlResolver 接口。此标记将变为从这个文件生成的 HTML 文档中的超级链接。IDL 文档规则 全面介绍了 UNOIDL 文档注释。

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages