2009-02-18 21 views
14

Sto utilizzando Doxygen per generare documentazione per la nostra API, scritta in C#. Tuttavia, espone membri privati ​​/ protetti. C'è un modo per nascondere quelli?Doxygen: nascondere il metodo privato/protetto ... e suggerimenti

ho capito come nascondere i file: EXCLUDE = Lista di nomi di file

Eppure, ho bisogno di più granularità e quindi gli utenti scudo dal rumore API inutili. Un file di Doxygen di esempio sarebbe apprezzato così come consigli/trucchi.

Quali strumenti utilizzate per generare API dal codice sorgente?

Mi sento un po 'abbandonato nel XVIII secolo mentre uso Doxygen in C# tramite C++.

+0

Se doxygen è solo un mezzo per generare una buona documentazione API, utilizzerei [Sandcastle/SHFB] (https://github.com/EWSoftware/SHFB) o [DocFX] (https: //dotnet.github. io/docfx /) invece. Quando ho preso in considerazione doxygen for C# circa dieci anni fa, non ho visto adattarsi le nuove funzionalità linguistiche tanto velocemente quanto le abbiamo adattate nel nostro codice di produzione, quindi siamo andati con Sandcastle. – mbx

risposta

17

Non so quanto bene C# sia supportato da Doxygen.

per nascondere soci privati, si cambia Doxyfile file di configurazione come segue:

EXTRACT_PRIVATE  = YES 

Molte altre opzioni possono essere impostate per vari tipi di estrazione/nascondere elementi di codice, ad esempio, citando Doxyfile stessa:

# 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

alcune possibilità, dal Doxygen manual:

HIDE_UNDOC_MEMBERS, HIDE_UNDOC_ CLASSI: Ovviamente funziona solo se si documentano solo i membri pubblici.

INTERNAL_DOCS: consente di utilizzare il markup interno per escludere i commenti dalla versione "pubblica" della documentazione.

ENABLED_SECTIONS: sono la versione più generale di INTERNAL_DOCS

13

Partenza bandiera @cond per doxygen. In C# ho nascondere alcuni dei nostri membri di crittografia delle password in questo modo:

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

La documentazione doxygen vorrebbero far credere che avete bisogno di un simbolo, condizionale e definita da Doxygen e utilizzato sulla linea @cond, ma che non ha funzionato per me. Questo metodo ha fatto.

8

questo funziona per me, per nascondere grandi blocchi di codice e la documentazione:

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

Run with ENABLED_SECTIONS = PRIVATE per creare la propria versione interna dei documenti. Puoi avere diverse condizioni e abilitarle/disabilitarle in base al pubblico.

Per nascondere solo una parte di un blocco di documentazione, utilizzare \internal (sarà nascondere fino alla fine del blocco a meno che \endinternal viene trovato)


Nota: è possibile utilizzare @ la notazione, se si preferisce sopra backslash.

Problemi correlati