If you look at the online Slice reference, you will find reference documentation for all the Slice definitions used by Ice and its services. In the binary distributions of Ice, you will also find HTML documentation that contains the same information. Both the PDF and the HTML documentation are generated from special comments in the Slice definitions by
slice2html, a tool that scans Slice definitions for special comments and generates HTML pages for those comments.
/**
*
* Information about the current method invocation for servers.
* Each operation on the server has a [Current] as its implicit
* final parameter. [Current] is mostly used for Ice services.
* Most applications ignore this parameter.
*
**/
local struct Current {
/**
* The object adapter.
**/
ObjectAdapter adapter;
/**
* Information about the connection over which the current
* method invocation was received. If the invocation is direct
* due to collocation optimization, this value is set to null.
**/
Connection con;
/**
* The Ice object identity.
**/
Identity id;
/**
* The facet.
***/
string facet;
/**
* The operation name.
**/
string operation;
/**
* The mode of the operation.
**/
OperationMode mode;
/**
* The request context, as received from the client.
**/
Context ctx;
/**
* The request id unless oneway (0) or collocated (‑1).
**/
int requestId;
};
Any comment that starts with /** and ends with
**/ is a documentation comment. Such a comment can precede any Slice construct, such as a module, interface, structure, operation, and so on. Within a documentation comment, you can either start each line with a
*, or you can leave the beginning of the line blank—
slice2html can handle either convention:
/**
*
* This is a documentation comment for which every line
* starts with a '*' character.
**/
/**
This is a documentation comment without a leading '*'
for each line. Either style of comment is fine.
**/
The first sentence of the documentation comment for a Slice construct should be a summary sentence.
slice2html generates an index of all Slice constructs; the first sentence of the comments for each Slice construct is ued as a summary in that index.
/**
* An empty [name] denotes a null object.
**/
This generates a hyperlink for the name markup that points at the definition of the corresponding Slice symbol. (The symbol can denote any Slice construct, such as a type, interface, parameter, or structure member.)
The directive @see is recognized by
slice2html. Where it appears, the generated HTML contains a separate section titled “See Also”, followed by a list of Slice identifiers. For example:
/**
* The object adapter, which is responsible for receiving requests
* from endpoints, and for mapping between servants, identities,
* and proxies.
*
* @see Communicator
* @see ServantLocator
**/
/**
* Look for an item with the specified
* primary and secondary key.
*
* @param p The primary search key.
*
* @param s The secondary search key.
*
* @return The item that matches the specified keys.
*
* @throws NotFound Raised if no item matches the specified keys.
**/
Item findItem(Key p, Key s) throws NotFound;
slice2html generates separate “Parameters”, “Return Value”, and “Exceptions” sections for these directives. Parameters are listed in the same order as they appear in the comments. (For clarity, that order should match the order of declaration of parameters for the corresponding operation.)
A documentation comment can contain any markup that is permitted by HTML in that place. For example, you can create separate paragraphs with
<P> and
</P> elements:
/**
* This is a comment for some Slice construct.</p>
*
* <p>This comment appears in a separate paragraph.
**/
Note that you must neither begin a documentation comment with a <p> element nor end it with a
</p> element because, in the generated HTML, documentation comments are already surrounded by
<p> and
</p> elements.
There are various other ways to create markup—for example, you can use
<table> or
<ul> elements. Please see the HTML specification
[25] for details.
4.22.2 Using slice2html
slice2html uses the following syntax:
Prepend FILE to each generated HTML file (except for
_sindex.html). This allows you to replace the HTML header and other preamble information with a custom version, so you can connect style sheets to the generated pages. The specified file must include the
<body> tag (but need not end with a
<body> tag).
FILE is expected to contain the string
TITLE on a line by itself, starting in column one. slice2html replaces the
TITLE string with the fully-scoped name of the Slice symbol that is documented on the corresponding page.
Append FILE to each generated HTML file (except for
_sindex.html). This allows you to add, for example, a custom footer to each generated page.
FILE is must end with a
</body> tag.
slice2html generates a file
_sindex.html that contains a table of contents of all Slice symbols that hyperlink to the corresponding page. This option allows you to replace the standard header with a custom header, for example, to attach a JavaScript. The specified file must include the
<body> tag (but need not end with a
<body> tag).
Append FILE to the generated
_sindex.html page. This allows you to add, for example, a custom footer to the table of contents, or to invoke a JavaScript.
FILE is must end with a
</body> tag.
With this option, slice2html looks in the specified directory for images to use for the generated navigation hyperlinks. (Without this option, text links are used instead.) Please see the generated HTML for the names of the various image files. (They can easily be found by looking for
img elements.)
slice2html generates sub-indexes for various Slice symbols. This option controls how many entries must be present before a sub-index is generated. For example, if
NUM is set to 3, a sub-index will be generated only if there are three or more symbols that appear in that index. The default settings is 1, meaning that a sub-index is always generated. To disable sub-indexes entirely, set
NUM to 0.