I have created a simple union as follows:

#ifndef _ANONUNION_H
#define _ANONUNION_H

#ifdef __cplusplus
///@brief Anonymous Union example.
namespace AnonUnion
{
#endif

        ///@brief Create a typename for our union.
        typedef union {
                ///@brief A short followed by two characters.
                struct {
                        short s;        ///<A short.
                        char ch1;       ///&lt;A single character.
                        char ch2;       ///&lt;Another character.
                };
                
                ///@brief Structure as an unsigned long.
                unsigned long ul;
        } Example;
#ifdef __cplusplus
}
#endif

#endif

When I process this file, called AnonUnion.h I get the usual output files. 
In particular, the index file looks like:
&lt;?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygenindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="index.xsd" version="1.8.11">
  <compound refid="union_anon_union_1_1_example"
kind="union"><name>AnonUnion::Example</name>
    <member
refid="union_anon_union_1_1_example_1a0d2cb966d6a40aa220fa172c2fb3562b"
kind="variable"><name>s</name></member>
    <member
refid="union_anon_union_1_1_example_1a25196dd24281a5d62f0cb98b2054a5c5"
kind="variable"><name>ch1</name></member>
    <member
refid="union_anon_union_1_1_example_1a43b624de604452d595fe32f6113ff7e5"
kind="variable"><name>ch2</name></member>
    <member
refid="union_anon_union_1_1_example_1a10a0a523db652b68d9b92073ad910ec2"
kind="variable"><name>@1</name></member>
    <member
refid="union_anon_union_1_1_example_1ae939d9fba73319ca43bd898ae3427cd5"
kind="variable"><name>ul</name></member>
  </compound>
  <compound refid="namespace_anon_union"
kind="namespace"><name>AnonUnion</name>
  </compound>
  <compound refid="_anon_union_8h" kind="file"><name>AnonUnion.h</name>
  </compound>
  <compound refid="dir_d44c64559bbebec7f509842c48db8b23"
kind="dir"><name>include</name>
  </compound>
</doxygenindex>

And the compound file looks like:

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.11">
  <compounddef id="union_anon_union_1_1_example" kind="union" language="C++"
prot="public">
    <compoundname>AnonUnion::Example</compoundname>
    <includes refid="_anon_union_8h" local="no">AnonUnion.h</includes>
      <sectiondef kind="public-attrib">
      <memberdef kind="variable"
id="union_anon_union_1_1_example_1a0d2cb966d6a40aa220fa172c2fb3562b"
prot="public" static="no" mutable="no">
        <type>short</type>
        <definition>short AnonUnion::Example::s</definition>
        <argsstring></argsstring>
        <name>s</name>
        <briefdescription>
<para>A short. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="include/AnonUnion.h" line="15" column="1"
bodyfile="include/AnonUnion.h" bodystart="15" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable"
id="union_anon_union_1_1_example_1a25196dd24281a5d62f0cb98b2054a5c5"
prot="public" static="no" mutable="no">
        <type>char</type>
        <definition>char AnonUnion::Example::ch1</definition>
        <argsstring></argsstring>
        <name>ch1</name>
        <briefdescription>
<para>A single character. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="include/AnonUnion.h" line="16" column="1"
bodyfile="include/AnonUnion.h" bodystart="16" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable"
id="union_anon_union_1_1_example_1a43b624de604452d595fe32f6113ff7e5"
prot="public" static="no" mutable="no">
        <type>char</type>
        <definition>char AnonUnion::Example::ch2</definition>
        <argsstring></argsstring>
        <name>ch2</name>
        <briefdescription>
<para>Another character. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="include/AnonUnion.h" line="17" column="1"
bodyfile="include/AnonUnion.h" bodystart="17" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable"
id="union_anon_union_1_1_example_1a10a0a523db652b68d9b92073ad910ec2"
prot="public" static="no" mutable="no">
        <type>struct AnonUnion::Example::@0</type>
        <definition>struct AnonUnion::Example::@0
AnonUnion::Example::@1</definition>
        <argsstring></argsstring>
        <name>@1</name>
        <briefdescription>
<para>A short followed by two characters. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="include/AnonUnion.h" line="18" column="1"/>
      </memberdef>
      <memberdef kind="variable"
id="union_anon_union_1_1_example_1ae939d9fba73319ca43bd898ae3427cd5"
prot="public" static="no" mutable="no">
        <type>unsigned long</type>
        <definition>unsigned long AnonUnion::Example::ul</definition>
        <argsstring></argsstring>
        <name>ul</name>
        <briefdescription>
<para>Structure as an unsigned long. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="include/AnonUnion.h" line="21" column="1"
bodyfile="include/AnonUnion.h" bodystart="21" bodyend="-1"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
<para>Create a typename for our union. </para>    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <collaborationgraph>
      <node id="1">
        <label>AnonUnion::Example</label>
        <link refid="union_anon_union_1_1_example"/>
      </node>
    </collaborationgraph>
    <location file="include/AnonUnion.h" line="12" column="1"
bodyfile="include/AnonUnion.h" bodystart="12" bodyend="22"/>
    <listofallmembers>
      <member
refid="union_anon_union_1_1_example_1a25196dd24281a5d62f0cb98b2054a5c5"
prot="public"
virt="non-virtual"><scope>AnonUnion::Example</scope><name>ch1</name></member>
      <member
refid="union_anon_union_1_1_example_1a43b624de604452d595fe32f6113ff7e5"
prot="public"
virt="non-virtual"><scope>AnonUnion::Example</scope><name>ch2</name></member>
      <member
refid="union_anon_union_1_1_example_1a0d2cb966d6a40aa220fa172c2fb3562b"
prot="public"
virt="non-virtual"><scope>AnonUnion::Example</scope><name>s</name></member>
      <member
refid="union_anon_union_1_1_example_1ae939d9fba73319ca43bd898ae3427cd5"
prot="public"
virt="non-virtual"><scope>AnonUnion::Example</scope><name>ul</name></member>
    </listofallmembers>
  </compounddef>
</doxygen>

What I would like to know is how to identify that s, ch1 and ch2 are part of
the anonymous structure and that ul1 and the anonymous structure are part of
the union.

I need to know this information to reconstruct the parsed input as part of a
documentation package I am creating using an automated tool.

I noticed that several other people have had similar questions over the
years but none of them had a satisfactory answer that enables me to solve
this problem.

Thank you.

Carey




--
View this message in context: 
http://doxygen.10944.n7.nabble.com/C-Anonymous-Structure-Identification-XML-Output-tp7668.html
Sent from the Doxygen - Users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Doxygen-users mailing list
Doxygen-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/doxygen-users

Reply via email to