【问题标题】:Can doxygen extract protection levels from itcl class members?doxygen 可以从 itcl 类成员中提取保护级别吗?
【发布时间】:2013-03-04 19:34:32
【问题描述】:

我正在尝试使用 doxygen 来记录我的 itcl 代码(版本 1.8.2)。但是,它似乎错过了保护级别(公共/受保护/私有)。此外,它将公共变量与实例变量混为一谈,将所有变量标记为静态(只有公共应该是静态的)。第三,它不喜欢带有初始化语句的构造函数。在下面的代码上运行 doxygen 可以明显看出所有这些行为。前两种行为在 doxygen 手册本身的 tcl 代码示例中也很明显。 doxygen 中 tcl 扫描仪的这些已知限制是什么?谢谢。

##\file

## MyClass
itcl::class MyClass {
    private common a     ;#< private common a
    protected common b   ;#< protected common b
    public common c      ;#< public common c
    private variable x   ;#< private variable x
    protected variable y ;#< protected variable y
    public variable z    ;#< public variable z
    ## private proc aa
    private proc aa args {}
    ## protected proc bb
    protected proc bb args {}
    ## public proc cc
    public proc cc args {}
    ## private method xx
    private method xx args {}
    ## protected method yy
    protected method yy args {}
    ## public method zz
    public method zz args {}
    ## constructor
    constructor args {} { 
        eval configure $args 
    }
}

【问题讨论】:

  • 好问题!不知道……

标签: tcl doxygen


【解决方案1】:

有一种(实用的)方法可以让 doxygen 了解类方法以及实例和公共变量的范围。不过,生成的文档仍将所有 ivars 报告为“静态”。

用于确定方法/ivar 范围的 doxygen 命令有:

## \private
## \protected
## \public

我从 doxygen 文档 example 推断出这一点,尽管关键字也作为 doxygen 命令存在。

doxygen 和 Tcl 存在许多我无法克服的问题。

  • 实例变量记录为“静态”
  • 简要文档 (;#
  • 在类中声明的 proc 被忽略(尽管在任何其他命名空间中声明它们,但该类自己的作品,甚至是父命名空间)。

并且在 doxygen 的 bugzilla 中没有报告关于此的错误...

我已经重写了您的示例,并添加了更多关于哪些有效和哪些无效的示例。

##\file

## MyClass
itcl::class MyClass {

   ## \private common a
   private common a
   ## \protected common b
   protected common b 
   ## common c
   public common c

   private variable t   ;#<  variable x \private
   protected variable u ;#<  variable u \protected
   public variable v    ;#<  variable v \public

   private variable x   ;#< \private variable x 
   protected variable y ;#< \protected variable y
   public variable z    ;#< \public variable z

   ## \private proc aa
   private proc aa args {}
   ## \protected proc bb
   protected proc bb args {}

   private method xx args {} ;#< \private method xx
   protected method yy args {} ;#< \protected method yy
   public method zz args {} ;#< \public method zz


   ## \private variable k
   variable k   
   ## \protected variable l
   variable l
   ## \public variable m
   variable m   

   ## constructor
   constructor args {} { 
      eval configure $args 
   }

   ## proc proc comment
   proc cc { args } {}

}

## proc proc comment outside
proc dd { args } {}

namespace eval ::MyClass {
   ## proc proc comment outside
   proc ee { args } {}
}

【讨论】:

  • 是的,我也尝试使用预处理器插入保护级别命令,但在类中的 procs 出现问题后放弃了。
猜你喜欢
  • 1970-01-01
  • 2012-07-04
  • 1970-01-01
  • 2022-07-20
  • 2018-09-03
  • 1970-01-01
  • 2018-09-15
  • 2011-11-10
  • 2014-12-31
相关资源
最近更新 更多