C++ Anonymous Structure Identification (XML Output)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

C++ Anonymous Structure Identification (XML Output)

CareyG
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; ///<A single character.
                        char ch2; ///<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:
<?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
Reply | Threaded
Open this post in threaded view
|

Re: C++ Anonymous Structure Identification (XML Output)

Richard Damon
On 7/15/16 7:27 PM, CareyG wrote:

> 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:
<snipped>

> 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
I don't see any mention of the anonymous struct in the xml, which might
not be that surprising as doxygen doesn't have anything to say about
this struct since it is totally anonymous.

You probably don't want to give it a member name, as that would require
a lot of changes in the code, but perhaps if you gave it a struct tag,
you might get doxygen to note its existence, and that shouldn't change
how you use it.

--
Richard Damon


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/doxygen-users
Reply | Threaded
Open this post in threaded view
|

Re: C++ Anonymous Structure Identification (XML Output)

Negreanu Marius
Hi,

Doxygen's xmlgen ignores anonymous scopes/compounds/members purposefully.


br

On Sat, Jul 16, 2016 at 4:35 AM, Richard Damon <[hidden email]> wrote:

> On 7/15/16 7:27 PM, CareyG wrote:
>> 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:
> <snipped>
>> 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
> I don't see any mention of the anonymous struct in the xml, which might
> not be that surprising as doxygen doesn't have anything to say about
> this struct since it is totally anonymous.
>
> You probably don't want to give it a member name, as that would require
> a lot of changes in the code, but perhaps if you gave it a struct tag,
> you might get doxygen to note its existence, and that shouldn't change
> how you use it.
>
> --
> Richard Damon
>
>
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/doxygen-users



--
Regards!
http://groleo.wordpress.com

------------------------------------------------------------------------------
_______________________________________________
Doxygen-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/doxygen-users