Доксиген:скрытие частного/защищенного метода… и советы [закрыто]

StackOverflow https://stackoverflow.com/questions/562763

  •  05-09-2019
  •  | 
  •  

Вопрос

Я использую Doxygen для создания документации для нашего API, написанной на C#.Однако он предоставляет доступ к частным/защищенным членам.Есть ли способ скрыть их?

Я понял, как скрыть файлы:ИСКЛЮЧИТЬ = Список имен файлов

Тем не менее, мне нужно больше детализации и, таким образом, оградить пользователей от ненужного шума API.Будем признательны за образец файла Doxygen, а также за советы и подсказки.

Какие инструменты вы используете для генерации API из исходного кода?

Я чувствую себя несколько забытым в 18 веке, когда использую Doxygen в C# вместо C++.

Это было полезно?

Решение

Я не знаю, насколько хорошо C# поддерживается Doxygen.

Чтобы скрыть частных участников, вы меняете Doxyfile файл конфигурации следующим образом:

EXTRACT_PRIVATE        = YES

Для различных видов извлечения/скрытия элементов кода можно задать множество других опций, например, цитирование Doxyfile сам:

# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
# documentation are documented, even if no documentation was available. 
# Private class members and static file members will be hidden unless 
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES

EXTRACT_ALL            = YES

# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
# will be included in the documentation.

EXTRACT_PRIVATE        = YES

# If the EXTRACT_STATIC tag is set to YES all static members of a file 
# will be included in the documentation.

EXTRACT_STATIC         = YES

# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.

EXTRACT_LOCAL_CLASSES  = YES

# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.

EXTRACT_LOCAL_METHODS  = YES

# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespace are hidden.

EXTRACT_ANON_NSPACES   = NO

# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.

HIDE_UNDOC_MEMBERS     = NO

# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.

HIDE_UNDOC_CLASSES     = NO

# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.

HIDE_FRIEND_COMPOUNDS  = NO

Другие советы

Проверьте флаг @cond для doxygen.В C# я скрываю некоторые элементы шифрования паролей следующим образом:

    //! @cond
    private const String ENCRYPTEDFLAG = "xxxENCFLAGxxx";
    private const String SEED = "hi_i_r_@_seed";
    //! @endcond

Документация doxygen заставляет вас поверить, что вам нужен условный символ, определенный для doxygen и используемый в строке @cond, но у меня это не сработало.Этот метод сделал.

У меня это работает, чтобы скрыть большие куски кода и документации:

/*! \cond PRIVATE */
<here goes private documented source code>
/*! \endcond */

Бежать с ENABLED_SECTIONS = PRIVATE для создания внутренней версии документов.Вы можете иметь несколько условий и включать/отключать их в зависимости от аудитории.

Чтобы скрыть только часть блока документации, используйте \internal (будет скрываться до конца блока, если только \endinternal найден)


Примечание:вы можете использовать обозначение @, если предпочитаете его обратной косой черте.

Несколько возможностей, начиная с руководство по доксигену:

HIDE_UNDOC_MEMBERS, HIDE_UNDOC_CLASSES:Очевидно, работает только в том случае, если вы документируете только публичных участников.

INTERNAL_DOCS:Позволяет использовать разметку \internal для исключения комментариев из «публичной» версии документации.

ENABLED_SECTIONS:Более общая версия INTERNAL_DOCS

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top