List private, protected, and public members of the class separately.

web
Michael R Sweet 20 years ago
parent 465d3e7231
commit 36fc2a366d
  1. 41
      mxmldoc.c
  2. 29
      test/class.cxx

@ -1,5 +1,5 @@
/*
* "$Id: mxmldoc.c,v 1.33 2004/05/01 15:20:05 mike Exp $"
* "$Id: mxmldoc.c,v 1.34 2004/05/01 22:45:34 mike Exp $"
*
* Documentation generator using mini-XML, a small XML-like file parsing
* library.
@ -1717,6 +1717,7 @@ update_comment(mxml_node_t *parent, /* I - Parent node */
static void
write_documentation(mxml_node_t *doc) /* I - XML documentation */
{
int i; /* Looping var */
mxml_node_t *function, /* Current function */
*scut, /* Struct/class/union/typedef */
*arg, /* Current argument */
@ -1725,9 +1726,15 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
const char *name, /* Name of function/type */
*cname, /* Class name */
*defval, /* Default value */
*parent, /* Parent class */
*scope; /* Variable/method scope */
*parent; /* Parent class */
int inscope; /* Variable/method scope */
char prefix; /* Prefix character */
static const char * const scopes[] = /* Scope strings */
{
"private",
"protected",
"public"
};
/*
@ -1820,18 +1827,21 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
if ((parent = mxmlElementGetAttr(scut, "parent")) != NULL)
printf(" %s", parent);
puts("\n{");
scope = "";
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
for (i = 0; i < 3; i ++)
{
inscope = 0;
for (arg = mxmlFindElement(scut, scut, "variable", "scope", scopes[i],
MXML_DESCEND_FIRST);
arg;
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
arg = mxmlFindElement(arg, scut, "variable", "scope", scopes[i],
MXML_NO_DESCEND))
{
if (strcmp(scope, mxmlElementGetAttr(arg, "scope")))
if (!inscope)
{
scope = mxmlElementGetAttr(arg, "scope");
printf(" %s:\n", scope);
inscope = 1;
printf(" %s:\n", scopes[i]);
}
printf(" ");
@ -1840,16 +1850,16 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
}
for (function = mxmlFindElement(scut, scut, "function", NULL, NULL,
for (function = mxmlFindElement(scut, scut, "function", "scope", scopes[i],
MXML_DESCEND_FIRST);
function;
function = mxmlFindElement(function, scut, "function", NULL, NULL,
function = mxmlFindElement(function, scut, "function", "scope", scopes[i],
MXML_NO_DESCEND))
{
if (strcmp(scope, mxmlElementGetAttr(function, "scope")))
if (!inscope)
{
scope = mxmlElementGetAttr(function, "scope");
printf(" %s:\n", scope);
inscope = 1;
printf(" %s:\n", scopes[i]);
}
name = mxmlElementGetAttr(function, "name");
@ -1898,6 +1908,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
else
puts(");");
}
}
puts("};\n</pre>");
@ -2697,5 +2708,5 @@ ws_cb(mxml_node_t *node, /* I - Element node */
/*
* End of "$Id: mxmldoc.c,v 1.33 2004/05/01 15:20:05 mike Exp $".
* End of "$Id: mxmldoc.c,v 1.34 2004/05/01 22:45:34 mike Exp $".
*/

@ -3,8 +3,6 @@ class foo_c : public bar_c // Foo class derived from bar
float foo; /* Real number */
int bar; /* Integer */
static int global; /* Global integer */
public:
foo_c(float f, int b);
@ -40,11 +38,36 @@ class foo_c : public bar_c // Foo class derived from bar
// 'set_foobar()' - Set foo and optionally bar (should show default args).
void
set_foobar(float f, int b = 0)
set_foobar(float f, // I - Value of foo
int b = 0) // I - Value of bar
{
foo = f;
bar = b;
}
protected:
static int global; /* Global integer */
// 'get_global()' - Get the global integer.
int // O - Integer
get_global()
{
return (global);
}
private:
int barfoo; // Another private integer
public:
// 'get_barfoo()' - Get the barfoo value.
int // O - Barfoo value
get_barfoo()
{
return (barfoo);
}
}
// 'foo_c::foo_c()' - Create a foo_c class.

Loading…
Cancel
Save