Doxygen: сокрытие частного/защищенного метода... и советы

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

Я понял, как скрыть файлы: EXCLUDE = Список имен файлов

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

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

Я чувствую себя несколько в восемнадцатом веке, поскольку я использую Doxygen в С# с помощью С++.

Ответы

Ответ 1

Я не знаю, насколько хорошо С# поддерживается 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

Ответ 2

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

    //! @cond
    private const String ENCRYPTEDFLAG = "xxxENCFLAGxxx";
    private const String SEED = "[email protected]_seed";
    //! @endcond

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

Ответ 3

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

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

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

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


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

Ответ 4

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

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

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

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