Boost logo

Boost :

From: Anthony Williams (anthony.williamsNOSPAM_at_[hidden])
Date: 2002-11-04 10:45:37


Douglas Gregor writes:
> On Wednesday 30 October 2002 08:35 pm, David Bergman wrote:
> > I used to do *a lot of* LaTeX macroing back then, and can probably catch
> > up if noone else volunteers ;-)
>
> Sold!
>
> > Does anyone have an idea of what macros we would need (the actual
> > enumeration could be stolen from some existing C++ "literation" system,
> > such as Doxygen(?))?
>
> Well, I picked a set of constructs for the XSLT/XML prototype. You're welcome
> to steal those if you'd like, or completely ignore them and go with something
> better :). Here's a possible LaTeXified fragment:
>
> \begin{namespace}{boost}
> \begin{class}{function}
> \templateparam{Signature}
> \templateparam{Allocator}[std::allocator<void>]
> \typedef{Allocator}{allocator_type}
> \end{class}
> \end{namespace}

As a test, I have a LaTeX stylesheet that converts the following into
syntactically-valid, but poorly formatted, C++:

\begin{namespace}{hello_there}
  \begin{class}{someclass}
    \templatetypeparam[default_type]{boo}
    \templatetypeparam{foo}
    \baseclass[public]{foo}
    \baseclass[private]{abc}
    \baseclass[private virtual]{def}
    \typedef{int}{int_type}

    \begin{class}{nestedclass}
      \templatetypeparam{Allocator}
      \baseclass{abc}
      \begin{class}{double_nested}
      \end{class}
    \end{class}
  \end{class}

  \typedef{double}{float_type}
\typedef{someclass<foo>}{footype}
\end{namespace}

This becomes:

namespace hello_there
{
template < typename boo = default_type, typename foo >
class someclass :
public foo, private abc, private virtual def
{
typedef int int_type;
template < typename Allocator >
class nestedclass :
abc
{
class double_nested
{
};
template < typename Allocator >
class nestedclass :
abc
{
};
};
typedef double float_type;
typedef someclass<foo> footype;
}

With a bit of effort, I could improve the formatting. I also have a partial
TeX4HT stylesheet to convert this LaTeX to Doug's suggested XML syntax.

Oh, and to the people who know LaTeX --- yes, those are real underscores, not
\_. This messes up using $$ for displaymath, but $ for math still works, with
underscore invoking subscript as normal.

Anthony

-- 
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.
Remove NOSPAM when replying, for timely response.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk