Ddoc and version
Derek Parnell
derek at nomail.afraid.org
Thu Aug 17 17:15:44 PDT 2006
On Fri, 18 Aug 2006 08:01:43 +1000, Derek Parnell wrote:
> On Thu, 17 Aug 2006 14:29:39 -0700, Sean Kelly wrote:
>
>>
>> You can also document a function declaration:
>>
>> version(XYZZY)
>> {
>> /** Some description.
>> */
>> void someFunc();
>> }
>> else
>> {
>> /** Some other description.
>> */
>> void someFunc();
>> }
>>
>> void someFunc()
>> {
>> ...
>> }
>>
>> In a few cases I generate docs inside version(DDoc) blocks rather than
>> above the actual implementation, either because I have different
>> versions of a function for different platforms and I don't want to tie
>> the docs to a specific platform block, or because I'm using some dirty
>> trick to declare the function that I don't want the user to be aware of.
>> This last case is most common in code where I'm hacking around ITI
>> limitations and the function decl doesn't exactly match what it 'should' be.
>
> Hmmm ... I'll give it try. Thanks.
Thanks, that worked.
version(DDOC)
{
version(BoolUnknown)
{
/**
* Convert to a displayable string.
*
* False displays as "False" and True displays as "True".
*
* $(B Note:) However if the value has not been set yet, this
* returns "Unknown".
*
* Examples:
* --------------------
* Bool a = SomeFunc();
* std.stdio.writefln("The result was %s", a);
* --------------------
**/
char[] toString();
}
else
{
/**
* Convert to a displayable string.
*
* False displays as "False" and True displays as "True".
*
* Examples:
* --------------------
* Bool a = SomeFunc();
* std.stdio.writefln("The result was %s", a);
* --------------------
**/
char[] toString();
}
}
else
{
char[] toString()
{
version(BoolUnknown)
{
if (m_Val == -1)
return "Unknown".dup;
}
if (m_Val == 1)
return "True".dup;
return "False".dup;
}
}
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
18/08/2006 10:09:49 AM
More information about the Digitalmars-d-bugs
mailing list