summaryrefslogtreecommitdiff
path: root/xml2cmp/source/xcd/xmltree.cxx
blob: 0626374e47d99d620323a1db3aa21079404d45c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


#include <xmltree.hxx>


// NOT FULLY DEFINED SERVICES
#include <cr_html.hxx>


char  C_sMODULEDESCRIPTION[] = "module-description";
char  C_sCOMPONENTDESCRIPTION[] = "component-description";
char  C_sAuthor[] = "author";
char  C_sName[] = "name";
char  C_sDescription[] = "description";
char  C_sReferenceDocu[] = "reference-docu";
char  C_sModuleName[] = "module-name";
char  C_sLoaderName[] = "loader-name";
char  C_sSupportedService[] = "supported-service";
char  C_sServiceDependency[] = "service-dependency";
char  C_sProjectBuildDependency[] = "project-build-dependency";
char  C_sRuntimeModuleDependency[] = "runtime-module-dependency";
char  C_sLanguage[] = "language";
char  C_sStatus[] = "status";
char  C_sType[] = "type";
char  C_sAttr_value[] = "value";
char  C_sAttr_xl_href[] = "xlink:href";
char  C_sAttr_xl_role[] = "xlink:role";
char  C_sAttr_xl_title[] = "xlink:title";
char  C_sAttr_xmlns[] = "xmlns:xlink";
char  C_sAttr_xl_type[] = "xlink:type";
char  C_sCompDescrListTitle[] = "Component Descriptions";


FreeChoiceElement * Create_ModuleDescrOptional_Element(
                        MultipleTextElement * &
                                            o_rTypes,
                        MultipleTextElement * &
                                            o_rServiceDependencies );
FreeChoiceElement * Create_CompDescrOptional_Element(
                        MultipleTextElement * &
                                            o_rTypes,
                        MultipleTextElement * &
                                            o_rServiceDependencies );



ModuleDescription::ModuleDescription()
    :   SequenceElement(C_sMODULEDESCRIPTION),
        pModuleName(0),
        pCdList(0),
        pTypes(0),
        pServiceDependencies(0)
{
    pModuleName = new MdName;
    AddChild( *pModuleName );
    pCdList = new CompDescrList;
    AddChild( *pCdList );
    AddChild( *Create_ModuleDescrOptional_Element( pTypes, pServiceDependencies ) );
}

const Simstr &
ModuleDescription::ModuleName() const
{
    return pModuleName->Data();
}

void
ModuleDescription::Get_SupportedServices( List< const MultipleTextElement * > & o_rServices ) const
{
    o_rServices.push_back(pServiceDependencies);
    pCdList->Get_SupportedServices( o_rServices );
}

void
ModuleDescription::Get_Types( List< const MultipleTextElement * > & o_rTypes ) const
{
    o_rTypes.push_back(pTypes);
    pCdList->Get_Types( o_rTypes );
}

void
ModuleDescription::Get_ServiceDependencies( List< const MultipleTextElement * > & o_rServices ) const
{
    pCdList->Get_ServiceDependencies( o_rServices );
}

ComponentDescription::ComponentDescription()
    :   SequenceElement(C_sCOMPONENTDESCRIPTION,1),
        pComponentName(0),
        pSupportedServices(0),
        pTypes(0),
        pServiceDependencies(0)
{
    AddChild( *new SglTextElement(C_sAuthor, lt_nolink, false) );
    pComponentName = new CdName;
    AddChild( *pComponentName );
    AddChild( *new SglTextElement(C_sDescription, lt_nolink, false) );
    AddChild( *new SglTextElement(C_sLoaderName, lt_idl, true) );
    AddChild( *new SglTextElement(C_sLanguage, lt_nolink, false) );
    AddChild( *new SglAttrElement(C_sStatus, C_sAttr_value) );
    pSupportedServices = new SupportedService;
    AddChild( *pSupportedServices );
    AddChild( *Create_CompDescrOptional_Element( pTypes, pServiceDependencies ) );
}

CompDescrList::CompDescrList()
    :   ListElement(C_sCOMPONENTDESCRIPTION, 0)
{
}

void
CompDescrList::Write2Html( HtmlCreator & io_rHC ) const
{
    io_rHC.StartBigCell(C_sCompDescrListTitle);
    ListElement::Write2Html(io_rHC);
    io_rHC.FinishBigCell();
}

XmlElement *
CompDescrList::Create_and_Add_NewElement()
{
    ComponentDescription * pCD = new ComponentDescription;
    Children().push_back(pCD);
    aCDs.push_back(pCD);
    return pCD;
}

void
CompDescrList::Get_SupportedServices( List< const MultipleTextElement * > & o_rResult ) const
{
    unsigned i_max = aCDs.size();
    for (unsigned i = 0; i < i_max; ++i)
    {
        o_rResult.push_back(& aCDs[i]->SupportedServices());
    }  // end for
}

void
CompDescrList::Get_Types( List< const MultipleTextElement * > & o_rResult ) const
{
    unsigned i_max = aCDs.size();
    for (unsigned i = 0; i < i_max; ++i)
    {
        o_rResult.push_back(& aCDs[i]->Types());
    }  // end for
}

void
CompDescrList::Get_ServiceDependencies( List< const MultipleTextElement * > & o_rResult ) const
{
    unsigned i_max = aCDs.size();
    for (unsigned i = 0; i < i_max; ++i)
    {
        o_rResult.push_back(& aCDs[i]->ServiceDependencies());
    }  // end for
}

MdName::MdName()
    :   SglTextElement(C_sModuleName, lt_html, false)
{
}

void
MdName::Write2Html( HtmlCreator & io_rHC ) const
{
    io_rHC.Write_SglTextElement( *this, true );
}

CdName::CdName()
    :   SglTextElement(C_sName, lt_html, true)
{
}

void
CdName::Write2Html( HtmlCreator & io_rHC ) const
{
    io_rHC.Write_SglTextElement( *this, true );
}

SupportedService::SupportedService()
    :   MultipleTextElement(C_sSupportedService, lt_idl, true)
{
}

FreeChoiceElement *
Create_ModuleDescrOptional_Element( MultipleTextElement * & o_rTypes,
                                  MultipleTextElement * & o_rServiceDependencies )
{
    FreeChoiceElement * ret = Create_CompDescrOptional_Element( o_rTypes, o_rServiceDependencies );

    ret->AddChild( *new MultipleTextElement(C_sProjectBuildDependency, lt_nolink, false) );
    ret->AddChild( *new MultipleTextElement(C_sRuntimeModuleDependency, lt_nolink, false) );
    return ret;
}

FreeChoiceElement *
Create_CompDescrOptional_Element( MultipleTextElement * & o_rTypes,
                                  MultipleTextElement * & o_rServiceDependencies )
{
    FreeChoiceElement * ret = new FreeChoiceElement;
    const unsigned C_sRefDocuAttrNumber = 5;
    static const char * C_sRefDocuAttrNames[C_sRefDocuAttrNumber]
            = { C_sAttr_xl_href, C_sAttr_xl_role, C_sAttr_xl_title, C_sAttr_xmlns, C_sAttr_xl_type };

    ret->AddChild( *new MultipleAttrElement(C_sReferenceDocu, C_sRefDocuAttrNames, C_sRefDocuAttrNumber) );
    o_rServiceDependencies = new MultipleTextElement(C_sServiceDependency, lt_idl, true);
    ret->AddChild( *o_rServiceDependencies );
    o_rTypes = new MultipleTextElement(C_sType, lt_idl, true);
    ret->AddChild( *o_rTypes );
    return ret;
}



/* vim:set shiftwidth=4 softtabstop=4 expandtab: */