Introduction
Welcome to CppDoc.
The idea behind this application is simple: it generates HTML documentation
for your C++ classes, based on your source code and special comments embedded
within it.
CppDoc parses
source-code comments that start with "/**". So, it will associate the comment
"This is only a test." with the class Foo in the following example:
/**
* This is <I>only</I> a test.
*/
class Foo
{
...
};
CppDoc recognizes
and documents classes, member functions, member data, global functions, typedefs,
and enums. The documentation comments are optional; if you leave them out,
CppDoc will still generate a nicely-formatted set of documentation based
on your class hierarchy and class members.
Two modules
are included with CppDoc: the original one, which produces v1.0 output,
and a new one which produces full Javadoc-like output and which supports
Javadoc tags, such as @see
, @return
, etc.
That's pretty
much all there is to it. See the Help section of the main dialog for more
details.
Free
CppDoc is free, and may not be sold. It may be included with CD-ROM/DVD-ROM
distributions that carry nominal charges for the media. It may be distributed
freely on any website or through any other distribution mechanism, as long as
no part of it is changed in any way, and as long as its ReadMe file remains
with it.
This program is offered "AS IS", with no warranties of any kind.
If you like
If you like CppDoc, or if you have a request for a bug fix or enhancement, please
submit it here. You can sign up for the
mailing list here. Finally, if you would like
to donate to CppDoc, visit
www.cppdoc.com/donate.html.
Back to top
CppDoc Main Dialog
(Windows version only)
Title
The main title that
will be used throughout the generated documentation.
Company name
Modules may use this
in the generated documentation.
HTML header
This HTML code will
be included at the beginning of each generated page. You can enter either
an HTML fragment or the name of a file whose contents will be pasted into
the header.
HTML per item
This HTML code (HTML
fragment or filename, as above) is used as a template for each C++ class
on the index frame (not in the class details pages). The following
variables may be included:
- $C: the
class name
- $D: the
documentation for the class
- $F: the
source-file name for the class (usually the ".h" file)
- $G: a
secondary source-file name (usually a ".cpp" file, if $F was a ".h"
file)
- $H: the
detailed class HTML file
- $J: the
project (folder) of the class
- $P: the
class which this one extends ("parent")
- $R: the
root directory for source-file links (see Source code links below)
You can use this feature to customize the entire index frame; for example,
you could enter the following code:
class
<b>$C</b><blockquote>$D</blockquote><br>
This would produce
output like the following:
class Database
Encapsulation for an ODBC-accessible database.
class Query
This class represents a SQL query that can be fed to Database
.
...
Also, you
can mark an entire section to be skipped when a particular variable is missing.
To do this, just put "!variable-name" at the beginning and end
of the section. For example:
<b>$C</b>: primary source file is $F!G, secondary is $G!G.<br>
This would
produce output like the following:
Database: primary source
file is Database.h, secondary is Database.cpp.
Query: primary source file is Query.h.
...
HTML footer
This
HTML code (HTML fragment or filename, as above) will be included at the
end of each generated page.
Source code links
CppDoc
can include links to source code in the class details pages. Source code
links will be prepended by this path. For example, if you fill in "http://localhost/working/src"
here, then a link to "foo.cpp" in the documentation will be "http://localhost/working/src/foo.cpp".
If you choose the Default option, CppDoc will generate an HTML file for
each source code file, and link to that.
"In index frame, print class list hierarchically"
When
checked, the classes in the index will be indented according to their hierarchy,
rather than being listed in strict alphabetical order.
"Append <BR> to each documentation line"
A "<BR>"
tag will be added to the end of each new line of documentation (within
a documentation comment started by "/**").
Input
Enter
list of files or directories to process here. Separate items by spaces
or returns, and put double-quotes around files or directories with spaces
in their names. Note: by default, CppDoc uses the directory name as the
project name. You can change the project name by adding "=<project-name>"
to the path. So in the following example, code in the directory "include"
will be put into a project called "MFC":
"c:\program files\microsoft visual studio\vc98\mfc\include=MFC"
You can also exclude
individual subdirectories by prefixing them with '#', e.g.,
/working/includeme
#/working/includeme/skipme
Output (Main HTML page)
The
name of the master HTML file that will be generated.
Options
-
File Extensions (dialog): the list of extensions for files to process,
separated by commas. By default, CppDoc processes files with "c", "cpp",
"cxx", "h", "hpp", and "hxx" extensions.
-
Preprocessor Defs (dialog): additional defined preprocessor symbols
(besides "__cplusplus".
-
Module: the documentation module - either "cppdoc-standard" or "cppdoc-old"
by default.
-
Module Options (dialog): module-specific options. Note that this
is not enabled if the selected module does not offer any custom options.
Other Options (dialog)
-
Directory name for detail HTML pages: the name of the subdirectory
that will contain all of the generated detail pages.
-
Include global "const" and "static const" variables: Unless this is checked,
variables marked "const" or "static const" will be ignored.
-
Make contents of namespaces global: Normally, the contents of namespaces
are grouped like classes. This option forces namespace contents into
the global scope.
-
Include anonymous enums and unions: This option causes anonymous enums
and unions to be included in the documentation, with names like "anonymous_enum_1"
or "anonymous_union_2".
- Disable CppDoc tool tips: Turns off descriptive tool tips throughout the CppDoc dialogs.
- Document preprocessor symbols and defines: Causes #defines to be included in the documentation.
-
Documentation Comments: This section allows you to customize the
format of acceptable documentation comments.
- Additional Header Text:
Text you type here will be inserted within the <HEAD></HEAD>
tags on each generated page. This is commonly used for style-related tags.
- Use syntax coloring in source code links:
Adds syntax coloring to generated source code files when the "Source code
links" option (in the main dialog’s Advanced view) is set to "Default".
- Colors and Keywords:
Allows you to configure the syntax colors used for generated source
code files. Also allows you to add user-defined keywords.
- Tab size:
Sets the tab size for generated source code files when the "Source code links"
option (in the main dialog’s Advanced view) is set to "Default".
- Language Mappings:
Controls how file extensions are mapped to languages. All files with extensions
listed under a language will be treated as that language's source code.
If a file has an extension that is not listed in this section, it will be
treated as C++.
- Mix C++ and C#:
This option makes generated C++ documentation compatible with C# documentation.
It allows C# modifiers in C++ code, it uses the namespace (as opposed to
the directory) as the project for C++ files, and it replaces the C++ "::"
qualifier with C#'s ".".
- Use C++ namespace as project: Uses the namespace (as opposed to the directory) as the project for C++ files. This option is implied by the -mix-cpp-csharp option.
Back to top
Documentation Comments
Basic format
Documentation comments begin with "/**" and end with "*/". Preceding a
class, struct, typedef, enum, variable, or function with a documentation
comment will cause the contents of the comment to be attached to that entity.
Comments can include HTML formatting. For example, the following comment
is valid:
/**
*
This is a <B>test</B> of:
*
<UL>
*
<LI>documentation comments
*
<LI>HTML formatting
*
</UL>
*/
void foo()
{
}
It will attach this documentation to foo():
This is a test of:
- documentation comments
- HTML formatting
Special tags for the cppdoc-standard module
The cppdoc-standard module processes a number of special tags when they
are found at the beginning of a line within a documentation comment.
These tags should be used below normal documentation text.
-
@author name : adds name to the list of authors under
a section titled "Author". Enable this tag in the Module Options dialog
or with the -enable-author option.
-
@deprecated text : adds a Deprecated flag at the beginning
of the documentation, followed by text. Also adds the current entity
to the master deprecated list.
-
@exception: same as @throw.
-
@param name [ descrip]: adds name to the list
in the "Parameters" section. The description will be added if it is supplied.
-
@return descrip : adds a section titled "Returns", with the
given description.
-
@see reference : adds reference to the "See Also" section.
The reference can be any of the following:
-
HTML tag/text, which is added unmodified
-
a quoted string (e.g., "Foo Bar"), the contents of which are added
unmodified
-
[project].[ class-name][#member] [text
], which adds a link to the given member in class class-name
in project project . If project is omitted, the current
entity's project is assumed. If class-name is omitted, the current
class is assumed. If member is omitted, the link is to the class-file.
If text is omitted, default display text is added, based on the
actual link.
Examples:
@see <a href="http://www.cppdoc.com">CppDoc website</a>
@see "The Reference Manual"
@see parser.ParserExpression#eval(int)
@see ParserExpression#eval the illustrious eval function
@see ParserExpression
@see #eval the one-and-only eval (this is display text)
-
@since descrip: adds descrip to the "Since" section.
-
@throw: same as @throws.
-
@throws name [descrip]: adds name to the list
of exceptions in the "Throws" section. If descrip is given, it is
added next to name .
-
@version text : sets the text in the "Version" section. Enable
this tag in the Module Options dialog or with the -enable-version
option.
The following "floating tags" may be used anywhere in the documentation
comment, unlike the others which must appear at the beginning of a line.
-
{@docroot} replaced with the path to the document root (where the
main HTML file is located).
-
{@files} replaced with a list (<UL>) of links to the associated
source files for this entity.
-
{@file1} replaced with a link to the first source file (usually the
".h" file) for this entity.
-
{@file2} replaced with a link to the second source file (usually the
".cpp" file) for this entity.
-
{@link reference } replaced with a reference that is built
using the exact same syntax as the @see tag (above). For example:
/**
* Click {@link ParserExpression#eval here} to go
* to the eval() function in the ParserExpression
* class.
*/
Excluding files from processing
If you include the special comment
/**NODOCUMENT**/
at the beginning of a file, it will not be included in processing.
Excluding parts of files from processing
To exclude parts of a file from processing, put the following comment at the beginning of the section to be excluded:
/* CPPDOC_BEGIN_EXCLUDE */
Put the following comment at the end of the section to be excluded:
/* CPPDOC_END_EXCLUDE */
Including project-level and overview-level documentation
The cppdoc-standard module
allows you to include documentation for each project, and overview documentation.
To create project-level documentation, create a file called "project.html"
at the root for that project's source code. For overview documentation,
create a file called "overview.html" at the overall root directory to be
processed. These filenames may be changed in the Module Options dialog,
or as command-line flags for the cppdoc-standard module.
Back to top
CppDoc Command Line
Usage
cppdoc [flags] directory|file[=project-name] [...] output-filename
cppdoc_cmd [flags] directory|file[=project-name] [...] output-filename
Description
CppDoc accepts a space-separated list of source-code directories to process.
The last argument is the output filename for the HTML class index. If
you only provide one argument, CppDoc will create a file called "index.html".
Note: by default, CppDoc uses the directory name as the project name.
You can change the project name by adding "=<project-name>" to the
path. So in the following example, code in the directory "include" will
be put into a project called "MFC":
"c:\program files\microsoft visual studio\vc98\mfc\include=MFC"
Flags
-
-accept3slash: With this option, documentation comments will be parsed
from lines with three slashes (“///”). Equivalent to
comment-format="/**;*;*/;///;///;///"
.
- -additional-header=: This text will be inserted within
the <HEAD></HEAD> tags on each generated page. This is commonly used for style-related tags.
-
-autoquit: CppDoc will exit as soon as processing is complete (Windows dialog version only).
- -autorun: CppDoc will begin processing as soon as the dialog appears (Windows dialog version only).
- -autoview: CppDoc will open the output HTML class index when processing
is complete (Windows dialog version only).
- -classdir=: Sets the output directory for detailed class files. If
you do not specify this, a directory called “projects” will be created.
-
-comment-format=:
Sets the beginning, middle, and end strings (separated by
";") that define a documentation
comment. The default setting is
"/**;*;*/", which accepts
comments like the following one:
/**
* Example comment.
*/
This option also optionally accepts a second (alternate) set of strings,
which define an additional documentation format using "//"-style comments. For example, the
setting
"/**;*;*/;///;///;///"
will accept the following style in addition to the one shown above:
///
/// Example comment.
///
The comment specification can be set up to allow multiple comment
formats. The setting "//=-;//;//=-"
will accept both of the following styles:
//=
// Example comment.
//=
//-
// Example comment.
//-
Note that the last character of the start string may be repeated, so
the setting
"//=;//;//=" will accept
the following style:
//=================
// Example comment.
//=================
Also note that the "//" comments can be on a single line, e.g.,
/// Example comment.
int foo;
Finally, if you put the string "AFTER" in front of a documentation
comment format (e.g., "AFTER///;///;///"), then documentation comments
are read after their associated declarations, like this:
int foo; /// a documentation comment
- -company=: Set the title of the HTML class index.
- -Dname: Define the preprocessor symbol name.
-
-Dname=val: Assign the value val to the preprocessor
symbol name.
- -document-preprocessor: Include #define symbols and macros in the documentation.
- -disable-tooltips: Turn off descriptive tool tips throughout the CppDoc dialogs.
-
-extensions=: Set the list of file extensions to process, separated
by commas, e.g., "cpp,h,hpp".
- -footer=: Paste the given file onto the end of the HTML class index.
"-" means no footer.
-
-header=: Paste the given file onto the beginning of the HTML class
index. "-" means no header.
- -hier: The classes in the index will be indented according to their
hierarchy.
- -include-anonymous: This option causes anonymous enums and unions to be included in the documentation.
- -include-const: With this option, variables marked "const" or "static
const" are included; by default, they are ignored.
- -insertbr: A "<BR>" tag will be added to the end of each new
line of documentation (within a documentation comment started by "/**").
- -item=: Use the given file as a template for each class entry. See
HTML per item.
- -mix-cpp-csharp: This option makes
generated C++ documentation compatible with C# documentation. It allows
C# modifiers in C++ code, it uses the namespace (as opposed to the directory)
as the project for C++ files, and it replaces the C++ "::" qualifier with
C#'s ".".
- -module=: Set the name of the documentation module (without the ".dll"
extension) to use. With this distribution, valid values for this are "cppdoc-standard"
and "cppdoc-old". The default is "cppdoc-standard".
- -moduledir=: Override
the directory where CppDoc looks for its modules (default is "modules", in
the same directory as the CppDoc executable).
- -namespace-as-project: Use the namespace (as opposed to the directory) as the project for C++ files. Implied by the -mix-cpp-csharp option.
- -namespaces-global:
Force the contents of namespaces to apear as globals.
- -overwrite: CppDoc will overwrite the given output HTML file without
warning. Note that this option only works on the command-line; the dialog
ignores it.
- -source-code-tab-size: Set the tab size for generated source code files.
- -sourcedir=: Sets directory for links to source code files. See Source code links
.
- -suppress-syntax-color: Turn off syntax coloring in generated source code links.
- -syntax-color-comment: Set the color for comments in generated source code files (accepts either a standard HTML color name, like "white", or an HTML hexadecimal color value, like "#FF00FF").
- -syntax-color-keyword: Set the color for keywords in generated source code files (accepts either a standard HTML color name, like "white", or an HTML hexadecimal color value, like "#FF00FF").
- -syntax-color-number: Set the color for numbers in generated source code files (accepts either a standard HTML color name, like "white", or an HTML hexadecimal color value, like "#FF00FF").
- -syntax-color-operator: Set the color for operators (+, *, etc.) in generated source code files (accepts either a standard HTML color name, like "white", or an HTML hexadecimal color value, like "#FF00FF").
- -syntax-color-paren: Set the color for parentheses and brackets in generated source code files (accepts either a standard HTML color name, like "white", or an HTML hexadecimal color value, like "#FF00FF").
- -syntax-color-string: Set the color for string constants in generated source code files (accepts either a standard HTML color name, like "white", or an HTML hexadecimal color value, like "#FF00FF").
- -syntax-color-user-keyword: Set the color for user-defined keywords in generated source code files (accepts either a standard HTML color name, like "white", or an HTML hexadecimal color value, like "#FF00FF").
- -title=: Set the title of the HTML class index.
- -user-keywords=:
A comma-separated list of user-defined keywords for generated source code
files. These keywords can be assigned a special color with -syntax-color-user-keyword.
-
-ver: Print (or display) a message containing the version of the CppDoc executable.
Flags for the cppdoc-standard module
You can include these flags when you have selected "cppdoc-standard"
as the module. For boolean values, you can optionally use "=false" or "=true".
- -enable-author: Enable the @author tag (default is "false").
- -enable-deprecations: Enable the @deprecated tag and the master Deprecations
frame (default is "true").
- -enable-since: Enable the @since tag (default is "true").
-
-enable-version: Enable the @version tag (default is "false").
- -file-links-for-globals: Add a source-file link in the documentation for each
global function or variable.
- -header-background-dark=: Set the background color for dark table
headers.
-
-header-background-light=: Set the background color for light table
headers.
- -include-private: Include private members (default is "false").
- -include-protected: Include protected members (default is "true").
- -index-file-base= : Set the basename of all master index files (default
is "index").
- -generate-deprecations-list: Generate the master Deprecations frame
(default is "true").
-
-generate-hierarchy: Generate hierarchy tree frames (default is "true").
- -overview-html= : Set the name of the main overview HTML frame (default
is "overview.html").
- -reduce-summary-font: Reduce the font size of the left-hand (type) column in summary tables (default is "true").
- -selected-text-background=: Set the background color for selected
text in the navigation bar.
-
-separate-index-pages: Print a separate master index page for each
letter of the alphabet (defalt is "false").
- -show-cppdoc-version: Print the CppDoc version number in the footer on generated pages (default="true").
- -show-timestamp: Print a timestamp in the footer on generated pages (default="false").
- -summary-html= : Set the name of the summary HTML file per project
(default is "project.html").
- -suppress-details: Suppress the "Details" sections on generated pages (default is "false").
- -suppress-frames-links: Suppress the "Frames/No Frames" links on generated pages (default is "false").
- -table-background=: Set the color painted behind each table row (accepts
either a standard HTML color name, like “white”, or an HTML hexadecimal
color value, like “#FF00FF”).
- -wrap-long-lines: Allow long lines in summary tables to wrap (default is "false").
Generating a Command Line
You can generate a command line from the settings in the current dialog
by choosing "Generate Command Line…" from the system menu (the menu with
"Close" and "About CppDoc").
Pure Command Line Interface
CppDoc includes an executable (“cppdoc_cmd.exe”) which does not bring
up the dialog and which writes to standard output. It takes the following
additional options:
-
-help: Print a help message to standard output.
- -percent: Print status messages to show the percent-complete.
-
-quiet: Do not print status messages for files being processed.
-
-verbose: Print intermediate status messages for the contents
of files being processed.
Example
CppDoc title="My Class Documentation" company="My Company" hier autorun
overwrite classdir=projects sourcedir=/doc/src autoquit autoview
module cppdoc standard enable author enable deprecations=false d:\working\utils
d:\projects c:\temp\doc.html
Back to top
Privacy
CppDoc never, ever collects or sends any information about you without
your knowledge. If you send an email to me using the Feedback button, CppDoc
sends me the name you type, the return address you type, your comments,
and whether or not you checked "Please include me on the mailing list for
new versions."
When you use CppDoc’s Update feature to check for a new version, or if
you enable auto-update, no information about you is ever sent to the server
(CppDoc just reads a static file through http). The auto-update feature is
turned off by default.
Back to top
© 2001 Richard Feit. All rights reserved.