2009-02-18 4 views
14

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

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

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

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

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

+0

Если doxygen - это всего лишь средство для создания хорошей документации API, я бы использовал [Sandcastle/SHFB] (https://github.com/EWSoftware/SHFB) или [DocFX] (https: //dotnet.github. io/docfx /). Когда я считал doxygen для C# примерно десять лет назад, я не видел, чтобы он адаптировал новые языковые функции так же быстро, как мы их адаптировали в нашем производственном коде, поэтому мы пошли с Sandcastle. – mbx

ответ

17

Я не знаю, насколько хорошо 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 
3

несколько возможностей, от Doxygen manual:

HIDE_UNDOC_MEMBERS, HIDE_UNDOC_ КЛАССЫ: Очевидно, работает только в том случае, если вы только документируете публичных участников.

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

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

13

Отъезд @cond флаг для Doxygen. В C# я скрыть некоторые из наших членов шифрования паролей, как это:

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

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

8

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

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

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

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


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

 Смежные вопросы

  • Нет связанных вопросов^_^