XML-вывод Doxygen для структур C-lang с подструктурами - PullRequest
0 голосов
/ 29 ноября 2018

Структуры с подструктурами обрабатываются doxygen, как и ожидалось для выходного формата HTML.

Но для выходного формата XML они обрабатываются неоднозначно, как показано в следующем примере.

test.h

typedef struct {
  struct {
    int   joe;
    short jack;
  } bar;
  struct {
    int   joe;
    short jack;
    long  bill;
  } saloon;
} a;

typedef struct {
  struct {
    int   joe;
    short jack;
  } bar;
  struct {
    int   joe;
    long  bill;
  } saloon;
} b;

Doxyfile

PROJECT_NAME           = Test
OPTIMIZE_OUTPUT_FOR_C  = YES
TYPEDEF_HIDES_STRUCT   = NO
EXTRACT_ALL            = YES
EXTRACT_LOCAL_CLASSES  = YES
FILE_PATTERNS          = *.h 
SOURCE_BROWSER         = NO
GENERATE_HTML          = YES
HTML_OUTPUT            = html
GENERATE_HTMLHELP      = NO
SERVER_BASED_SEARCH    = NO
GENERATE_LATEX         = NO
GENERATE_XML           = YES
XML_OUTPUT             = xml

Выходные файлы structa.xml и structb.xml идентичны, за исключением атрибутов refid и самих имен элементов.

Вывод struct [a | b] .xml ( refid s и имена структур заменяются на «*», пустые теги xml вырезаются)

<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.8.13" xsi:noNamespaceSchemaLocation="compound.xsd">
    <compounddef id="structa" kind="struct" language="C++" prot="public">
        <compoundname>a</compoundname>
        <includes local="no" refid="test_8h">test.h</includes>
        <sectiondef kind="public-attrib">
            <memberdef id="struct*_*" kind="variable" mutable="no" prot="public" static="no">
                <type>int</type>
                <definition>int a::joe</definition>
                <name>joe</name>
                <location bodyend="-1" bodyfile="test.h" bodystart="*" column="1" file="test.h" line="*" />
            </memberdef>
            <memberdef id="struct*_*" kind="variable" mutable="no" prot="public" static="no">
                <type>short</type>
                <definition>short a::jack</definition>
                <name>jack</name>
                <location bodyend="-1" bodyfile="test.h" bodystart="*" column="1" file="test.h" line="*" />
            </memberdef>
            <memberdef id="struct*_*" kind="variable" mutable="no" prot="public" static="no">
                <type>struct a::@0</type>
                <definition>struct a::@0  a::bar</definition>
                <location column="1" file="test.h" line="*" />
            </memberdef>
            <memberdef id="struct*_*" kind="variable" mutable="no" prot="public" static="no">
                <type>long</type>
                <definition>long a::bill</definition>
                <name>bill</name>
                <location bodyend="-1" bodyfile="test.h" bodystart="*" column="1" file="test.h" line="*" />
            </memberdef>
            <memberdef id="structa_1a4eec237b24903ad639c4f91aad9d8236" kind="variable" mutable="no" prot="public" static="no">
                <type>struct a::@1</type>
                <definition>struct a::@1  a::saloon</definition>
                <name>saloon</name>
                <location column="1" file="test.h" line="*" />
            </memberdef>
        </sectiondef>
    </compounddef>
</doxygen>

При анализе XML я могу воссоздать только a.bar и b.bar .Но я не могу сказать, если у a.saloon и b.saloon есть только член bill или joe и bill или Джо , Джек и Билл .Это приводит к тому, что подструктура a.saloon и b.saloon различаются в отношении члена jack , но вывод XML doxygen идентичен для a.saloon и b.saloon .

У кого-нибудь есть идея решить эту проблему для разбора XML (не разбирая HTML вместо XML)?

1 Ответ

0 голосов
/ 29 ноября 2018

Было бы для вас решением создать неанонимные определения типа / структуры, например

typedef struct A {
  struct BAR {
    int   joe;
    short jack;
  } bar;
  struct SALOON {
    int   joe;
    short jack;
    long  bill;
  } saloon;
} a;

typedef struct B {
  struct BAR {
    int   joe;
    short jack;
  } bar;
  struct SALOON {
    int   joe;
    long  bill;
  } saloon;
} b;
...