Doxygen
Loading...
Searching...
No Matches
defgen.cpp File Reference
#include <stdlib.h>
#include "portable.h"
#include "defgen.h"
#include "doxygen.h"
#include "message.h"
#include "config.h"
#include "classlist.h"
#include "util.h"
#include "defargs.h"
#include "outputgen.h"
#include "dot.h"
#include "dotclassgraph.h"
#include "arguments.h"
#include "memberlist.h"
#include "namespacedef.h"
#include "filedef.h"
#include "filename.h"
#include "dir.h"
#include "textstream.h"
+ Include dependency graph for defgen.cpp:

Go to the source code of this file.

Macros

#define DEF_DB(x)
 

Functions

static void writeDEFString (TextStream &t, const QCString &s)
 
static void generateDEFForMember (const MemberDef *md, TextStream &t, const Definition *def, const QCString &prefix)
 
static void generateDEFClassSection (const ClassDef *cd, TextStream &t, const MemberList *ml, const QCString &kind)
 
static void generateDEFForClass (const ClassDef *cd, TextStream &t)
 
static void generateDEFSection (const Definition *d, TextStream &t, const MemberList *ml, const QCString &kind)
 
static void generateDEFForNamespace (const NamespaceDef *nd, TextStream &t)
 
static void generateDEFForFile (const FileDef *fd, TextStream &t)
 
void generateDEF ()
 

Macro Definition Documentation

◆ DEF_DB

#define DEF_DB ( x)

Definition at line 40 of file defgen.cpp.

Function Documentation

◆ generateDEF()

void generateDEF ( )

Definition at line 525 of file defgen.cpp.

526{
527 QCString outputDirectory = Config_getString(OUTPUT_DIRECTORY)+"/def";
528 Dir defDir(outputDirectory.str());
529 if (!defDir.exists() && !defDir.mkdir(outputDirectory.str()))
530 {
531 err("Could not create def directory in %s\n",qPrint(outputDirectory));
532 return;
533 }
534
535 QCString fileName=outputDirectory+"/doxygen.def";
536 std::ofstream f = Portable::openOutputStream(fileName);
537 if (!f.is_open())
538 {
539 err("Cannot open file %s for writing!\n",qPrint(fileName));
540 return;
541 }
542 TextStream t(&f);
543 t << "AutoGen Definitions dummy;\n";
544
545 if (Doxygen::classLinkedMap->size()+
548 {
549 for (const auto &cd : *Doxygen::classLinkedMap)
550 {
551 generateDEFForClass(cd.get(),t);
552 }
553 for (const auto &fn : *Doxygen::inputNameLinkedMap)
554 {
555 for (const auto &fd : *fn)
556 {
557 generateDEFForFile(fd.get(),t);
558 }
559 }
560 for (const auto &nd : *Doxygen::namespaceLinkedMap)
561 {
562 generateDEFForNamespace(nd.get(),t);
563 }
564 }
565 else
566 {
567 t << "dummy_value = true;\n";
568 }
569}
Class representing a directory in the file system.
Definition dir.h:75
static NamespaceLinkedMap * namespaceLinkedMap
Definition doxygen.h:115
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:105
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:96
This is an alternative implementation of QCString.
Definition qcstring.h:101
const std::string & str() const
Definition qcstring.h:526
Text streaming class that buffers data.
Definition textstream.h:36
#define Config_getString(name)
Definition config.h:32
static void generateDEFForClass(const ClassDef *cd, TextStream &t)
Definition defgen.cpp:317
static void generateDEFForFile(const FileDef *fd, TextStream &t)
Definition defgen.cpp:493
static void generateDEFForNamespace(const NamespaceDef *nd, TextStream &t)
Definition defgen.cpp:465
#define err(fmt,...)
Definition message.h:84
std::ofstream openOutputStream(const QCString &name, bool append=false)
Definition portable.cpp:665
const char * qPrint(const char *s)
Definition qcstring.h:661

References Doxygen::classLinkedMap, Config_getString, err, Dir::exists(), generateDEFForClass(), generateDEFForFile(), generateDEFForNamespace(), Doxygen::inputNameLinkedMap, Dir::mkdir(), Doxygen::namespaceLinkedMap, Portable::openOutputStream(), qPrint(), and QCString::str().

Referenced by generateOutput().

◆ generateDEFClassSection()

static void generateDEFClassSection ( const ClassDef * cd,
TextStream & t,
const MemberList * ml,
const QCString & kind )
static

Definition at line 299 of file defgen.cpp.

303{
304 if (cd && ml && !ml->empty())
305 {
306 t << " cp-section = {\n";
307 t << " sec-kind = '" << kind << "';\n";
308
309 for (const auto &md : *ml)
310 {
311 generateDEFForMember(md,t,cd,"sec");
312 }
313 t << " }; /* cp-section */\n";
314 }
315}
bool empty() const noexcept
Definition memberlist.h:59
static void generateDEFForMember(const MemberDef *md, TextStream &t, const Definition *def, const QCString &prefix)
Definition defgen.cpp:59

References MemberVector::empty(), and generateDEFForMember().

Referenced by generateDEFForClass().

◆ generateDEFForClass()

static void generateDEFForClass ( const ClassDef * cd,
TextStream & t )
static

Definition at line 317 of file defgen.cpp.

318{
319 // + brief description
320 // + detailed description
321 // - template arguments
322 // - include files
323 // + inheritance diagram
324 // + list of direct super classes
325 // + list of direct sub classes
326 // + collaboration diagram
327 // - list of all members
328 // + user defined member sections
329 // + standard member sections
330 // + detailed member documentation
331 // - examples
332
333 if (cd->isReference()) return; // skip external references.
334 if (cd->name().find('@')!=-1) return; // skip anonymous compounds.
335 if (cd->templateMaster()!=nullptr) return; // skip generated template instances.
336
337 t << cd->compoundTypeString() << " = {\n";
338 t << " cp-id = '" << cd->getOutputFileBase() << "';\n";
339 t << " cp-name = '" << cd->name() << "';\n";
340
341 for (const auto &bcd : cd->baseClasses())
342 {
343 t << " cp-ref = {\n" << " ref-type = base;\n";
344 t << " ref-id = '"
345 << bcd.classDef->getOutputFileBase() << "';\n";
346 t << " ref-prot = ";
347 switch (bcd.prot)
348 {
349 case Protection::Public: t << "public;\n"; break;
350 case Protection::Package: // package scope is not possible
351 case Protection::Protected: t << "protected;\n"; break;
352 case Protection::Private: t << "private;\n"; break;
353 }
354 t << " ref-virt = ";
355 switch(bcd.virt)
356 {
357 case Specifier::Normal: t << "non-virtual;"; break;
358 case Specifier::Virtual: t << "virtual;"; break;
359 case Specifier::Pure: t << "pure-virtual;"; break;
360 }
361 t << "\n };\n";
362 }
363
364 for (const auto &bcd : cd->subClasses())
365 {
366 t << " cp-ref = {\n" << " ref-type = derived;\n";
367 t << " ref-id = '"
368 << bcd.classDef->getOutputFileBase() << "';\n";
369 t << " ref-prot = ";
370 switch (bcd.prot)
371 {
372 case Protection::Public: t << "public;\n"; break;
373 case Protection::Package: // packet scope is not possible!
374 case Protection::Protected: t << "protected;\n"; break;
375 case Protection::Private: t << "private;\n"; break;
376 }
377 t << " ref-virt = ";
378 switch (bcd.virt)
379 {
380 case Specifier::Normal: t << "non-virtual;"; break;
381 case Specifier::Virtual: t << "virtual;"; break;
382 case Specifier::Pure: t << "pure-virtual;"; break;
383 }
384 t << "\n };\n";
385 }
386
387 size_t numMembers = 0;
388 for (const auto &ml : cd->getMemberLists())
389 {
390 if (!ml->listType().isDetailed())
391 {
392 numMembers+=ml->size();
393 }
394 }
395 if (numMembers>0)
396 {
397 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PubTypes()),"public-type");
398 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::Interfaces()),"interfaces");
399 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::Services()),"services");
400 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PubMethods()),"public-func");
401 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PubAttribs()),"public-attrib");
402 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PubSlots()),"public-slot");
403 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::Signals()),"signal");
404 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::DcopMethods()),"dcop-func");
405 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::Properties()),"property");
406 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PubStaticMethods()),"public-static-func");
407 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PubStaticAttribs()),"public-static-attrib");
408 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::ProTypes()),"protected-type");
409 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::ProMethods()),"protected-func");
410 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::ProAttribs()),"protected-attrib");
411 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::ProSlots()),"protected-slot");
412 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::ProStaticMethods()),"protected-static-func");
413 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::ProStaticAttribs()),"protected-static-attrib");
414 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PriTypes()),"private-type");
415 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PriMethods()),"private-func");
416 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PriAttribs()),"private-attrib");
417 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PriSlots()),"private-slot");
418 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PriStaticMethods()),"private-static-func");
419 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::PriStaticAttribs()),"private-static-attrib");
420 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::Friends()),"signal");
421 generateDEFClassSection(cd,t,cd->getMemberList(MemberListType::Related()),"related");
422 }
423
424 t << " cp-filename = '" << cd->getDefFileName() << "';\n";
425 t << " cp-fileline = '" << cd->getDefLine() << "';\n";
426 t << " cp-briefdesc = <<_EnD_oF_dEf_TeXt_\n"
427 << cd->briefDescription() << "\n_EnD_oF_dEf_TeXt_;\n";
428
429 t << " cp-documentation = <<_EnD_oF_dEf_TeXt_\n"
430 << cd->documentation() << "\n_EnD_oF_dEf_TeXt_;\n";
431
432 DotClassGraph inheritanceGraph(cd,GraphType::Inheritance);
433 if (!inheritanceGraph.isTrivial())
434 {
435 t << " cp-inheritancegraph = <<_EnD_oF_dEf_TeXt_\n";
436 inheritanceGraph.writeDEF(t);
437 t << "\n_EnD_oF_dEf_TeXt_;\n";
438 }
439 DotClassGraph collaborationGraph(cd,GraphType::Collaboration);
440 if (!collaborationGraph.isTrivial())
441 {
442 t << " cp-collaborationgraph = <<_EnD_oF_dEf_TeXt_\n";
443 collaborationGraph.writeDEF(t);
444 t << "\n_EnD_oF_dEf_TeXt_;\n";
445 }
446 t << "}; /* " << cd->compoundTypeString() << " */\n";
447}
virtual QCString compoundTypeString() const =0
Returns the type of compound as a string.
virtual const MemberLists & getMemberLists() const =0
Returns the list containing the list of members sorted per type.
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual MemberList * getMemberList(MemberListType lt) const =0
Returns the members in the list identified by lt.
virtual const ClassDef * templateMaster() const =0
Returns the template master of which this class is an instance.
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
virtual QCString getDefFileName() const =0
virtual int getDefLine() const =0
virtual QCString briefDescription(bool abbreviate=FALSE) const =0
virtual QCString documentation() const =0
virtual QCString getOutputFileBase() const =0
virtual bool isReference() const =0
virtual const QCString & name() const =0
Representation of a class inheritance or dependency graph.
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
static void generateDEFClassSection(const ClassDef *cd, TextStream &t, const MemberList *ml, const QCString &kind)
Definition defgen.cpp:299
@ Collaboration
Definition dotgraph.h:31
@ Inheritance
Definition dotgraph.h:31
@ Package
Definition types.h:26
@ Public
Definition types.h:26
@ Private
Definition types.h:26
@ Protected
Definition types.h:26
@ Virtual
Definition types.h:29
@ Normal
Definition types.h:29
@ Pure
Definition types.h:29

References ClassDef::baseClasses(), Definition::briefDescription(), Collaboration, ClassDef::compoundTypeString(), Definition::documentation(), QCString::find(), generateDEFClassSection(), Definition::getDefFileName(), Definition::getDefLine(), ClassDef::getMemberList(), ClassDef::getMemberLists(), Definition::getOutputFileBase(), Inheritance, Definition::isReference(), DotClassGraph::isTrivial(), Definition::name(), Normal, Package, Private, Protected, Public, Pure, ClassDef::subClasses(), ClassDef::templateMaster(), Virtual, and DotClassGraph::writeDEF().

Referenced by generateDEF().

◆ generateDEFForFile()

static void generateDEFForFile ( const FileDef * fd,
TextStream & t )
static

Definition at line 493 of file defgen.cpp.

494{
495 if (fd->isReference()) return; // skip external references
496
497 t << "file = {\n";
498 t << " file-id = '" << fd->getOutputFileBase() << "';\n";
499 t << " file-name = ";
500 writeDEFString(t,fd->name());
501 t << ";\n";
502
503 generateDEFSection(fd,t,fd->getMemberList(MemberListType::DecDefineMembers()),"define");
504 generateDEFSection(fd,t,fd->getMemberList(MemberListType::DecProtoMembers()),"prototype");
505 generateDEFSection(fd,t,fd->getMemberList(MemberListType::DecTypedefMembers()),"typedef");
506 generateDEFSection(fd,t,fd->getMemberList(MemberListType::DecSequenceMembers()),"sequence");
507 generateDEFSection(fd,t,fd->getMemberList(MemberListType::DecDictionaryMembers()),"dictionary");
508 generateDEFSection(fd,t,fd->getMemberList(MemberListType::DecEnumMembers()),"enum");
509 generateDEFSection(fd,t,fd->getMemberList(MemberListType::DecFuncMembers()),"func");
510 generateDEFSection(fd,t,fd->getMemberList(MemberListType::DecVarMembers()),"var");
511
512 t << " file-full-name = '" << fd->getDefFileName() << "';\n";
513 t << " file-first-line = '" << fd->getDefLine() << "';\n";
514
515 t << " file-briefdesc = <<_EnD_oF_dEf_TeXt_\n"
516 << fd->briefDescription() << "\n_EnD_oF_dEf_TeXt_;\n";
517
518 t << " file-documentation = <<_EnD_oF_dEf_TeXt_\n"
519 << fd->documentation() << "\n_EnD_oF_dEf_TeXt_;\n";
520
521 t << "}; /* file */\n";
522}
virtual MemberList * getMemberList(MemberListType lt) const =0
static void writeDEFString(TextStream &t, const QCString &s)
Definition defgen.cpp:42
static void generateDEFSection(const Definition *d, TextStream &t, const MemberList *ml, const QCString &kind)
Definition defgen.cpp:449

References Definition::briefDescription(), Definition::documentation(), generateDEFSection(), Definition::getDefFileName(), Definition::getDefLine(), FileDef::getMemberList(), Definition::getOutputFileBase(), Definition::isReference(), Definition::name(), and writeDEFString().

Referenced by generateDEF().

◆ generateDEFForMember()

static void generateDEFForMember ( const MemberDef * md,
TextStream & t,
const Definition * def,
const QCString & prefix )
static

Definition at line 59 of file defgen.cpp.

63{
64 QCString memPrefix;
65
66 // + declaration
67 // - reimplements
68 // - reimplementedBy
69 // - exceptions
70 // - const/volatile specifiers
71 // - examples
72 // + source definition
73 // - source references
74 // - source referenced by
75 // - include code
76
77 if (md->memberType()==MemberType::EnumValue) return;
78
79 QCString scopeName;
80 if (md->getClassDef())
81 scopeName=md->getClassDef()->name();
82 else if (md->getNamespaceDef())
83 scopeName=md->getNamespaceDef()->name();
84
85 t << " " << prefix << "-member = {\n";
86 memPrefix = " ";
87 memPrefix.append( prefix );
88 memPrefix.append( "-mem-" );
89
90 QCString memType;
91 bool isFunc=FALSE;
92 switch (md->memberType())
93 {
94 case MemberType::Define: memType="define"; break;
95 case MemberType::EnumValue: ASSERT(0); break;
96 case MemberType::Property: memType="property"; break;
97 case MemberType::Event: memType="event"; break;
98 case MemberType::Variable: memType="variable"; break;
99 case MemberType::Typedef: memType="typedef"; break;
100 case MemberType::Enumeration: memType="enum"; break;
101 case MemberType::Interface: memType="interface"; break;
102 case MemberType::Service: memType="service"; break;
103 case MemberType::Sequence: memType="sequence"; break;
104 case MemberType::Dictionary: memType="dictionary"; break;
105 case MemberType::Function: memType="function"; isFunc=TRUE; break;
106 case MemberType::Signal: memType="signal"; isFunc=TRUE; break;
107 case MemberType::Friend: memType="friend"; isFunc=TRUE; break;
108 case MemberType::DCOP: memType="dcop"; isFunc=TRUE; break;
109 case MemberType::Slot: memType="slot"; isFunc=TRUE; break;
110 }
111
112 t << memPrefix << "kind = '" << memType << "';\n";
113 t << memPrefix << "id = '"
114 << md->getOutputFileBase() << "_1" << md->anchor()
115 << "';\n";
116
117 t << memPrefix << "virt = ";
118 switch (md->virtualness())
119 {
120 case Specifier::Normal: t << "normal;\n"; break;
121 case Specifier::Virtual: t << "virtual;\n"; break;
122 case Specifier::Pure: t << "pure-virtual;\n"; break;
123 default: ASSERT(0);
124 }
125
126 t << memPrefix << "prot = ";
127 switch(md->protection())
128 {
129 case Protection::Public: t << "public;\n"; break;
130 case Protection::Protected: t << "protected;\n"; break;
131 case Protection::Private: t << "private;\n"; break;
132 case Protection::Package: t << "package;\n"; break;
133 }
134
135 if (md->memberType()!=MemberType::Define &&
137 )
138 {
140 t << memPrefix << "type = <<_EnD_oF_dEf_TeXt_\n" << typeStr << "\n"
141 << "_EnD_oF_dEf_TeXt_;\n";
142 }
143
144 t << memPrefix << "name = '" << md->name() << "';\n";
145
146 if (isFunc) //function
147 {
148 const ArgumentList &defAl = md->argumentList();
150 QCString fcnPrefix = " " + memPrefix + "param-";
151
152 auto defIt = defAl.begin();
153 for (const Argument &a : declAl)
154 {
155 const Argument *defArg = nullptr;
156 if (defIt!=defAl.end())
157 {
158 defArg = &(*defIt);
159 ++defIt;
160 }
161 t << memPrefix << "param = {\n";
162 if (!a.attrib.isEmpty())
163 {
164 t << fcnPrefix << "attributes = ";
165 writeDEFString(t,a.attrib);
166 t << ";\n";
167 }
168 if (!a.type.isEmpty())
169 {
170 t << fcnPrefix << "type = <<_EnD_oF_dEf_TeXt_\n"
171 << a.type << "\n_EnD_oF_dEf_TeXt_;\n";
172 }
173 if (!a.name.isEmpty())
174 {
175 t << fcnPrefix << "declname = ";
176 writeDEFString(t,a.name);
177 t << ";\n";
178 }
179 if (defArg && !defArg->name.isEmpty() && defArg->name!=a.name)
180 {
181 t << fcnPrefix << "defname = ";
182 writeDEFString(t,defArg->name);
183 t << ";\n";
184 }
185 if (!a.array.isEmpty())
186 {
187 t << fcnPrefix << "array = ";
188 writeDEFString(t,a.array);
189 t << ";\n";
190 }
191 if (!a.defval.isEmpty())
192 {
193 t << fcnPrefix << "defval = <<_EnD_oF_dEf_TeXt_\n"
194 << a.defval << "\n_EnD_oF_dEf_TeXt_;\n";
195 }
196 t << " }; /*" << fcnPrefix << "-param */\n";
197 }
198 }
199 else if ( md->memberType()==MemberType::Define
200 && md->argsString()!=nullptr)
201 {
202 QCString defPrefix = " " + memPrefix + "def-";
203 for (const Argument &a : md->argumentList())
204 {
205 t << memPrefix << "param = {\n";
206 t << defPrefix << "name = '" << a.type << "';\n";
207 t << " }; /*" << defPrefix << "-param */\n";
208 }
209 }
210
211 if (!md->initializer().isEmpty())
212 {
213 t << memPrefix << "initializer = <<_EnD_oF_dEf_TeXt_\n"
214 << md->initializer() << "\n_EnD_oF_dEf_TeXt_;\n";
215 }
216 // TODO: exceptions, const volatile
217 if (md->memberType()==MemberType::Enumeration) // enum
218 {
219 for (const auto &emd : md->enumFieldList())
220 {
221 t << memPrefix << "enum = { enum-name = " << emd->name() << ';';
222 if (!emd->initializer().isEmpty())
223 {
224 t << " enum-value = ";
225 writeDEFString(t,emd->initializer());
226 t << ';';
227 }
228 t << " };\n";
229 }
230 }
231
232 t << memPrefix << "desc-file = '" << md->getDefFileName() << "';\n";
233 t << memPrefix << "desc-line = '" << md->getDefLine() << "';\n";
234 t << memPrefix << "briefdesc = <<_EnD_oF_dEf_TeXt_\n"
235 << md->briefDescription() << "\n_EnD_oF_dEf_TeXt_;\n";
236 t << memPrefix << "documentation = <<_EnD_oF_dEf_TeXt_\n"
237 << md->documentation() << "\n_EnD_oF_dEf_TeXt_;\n";
238
239 //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers());
240
241 QCString refPrefix = " " + memPrefix + "ref-";
242 auto refList = md->getReferencesMembers();
243 for (const auto &rmd : refList)
244 {
245 if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef())
246 {
247 t << memPrefix << "referenceto = {\n";
248 t << refPrefix << "id = '"
249 << rmd->getBodyDef()->getOutputFileBase()
250 << "_1" // encoded ':' character (see util.cpp:convertNameToFile)
251 << rmd->anchor() << "';\n";
252
253 t << refPrefix << "line = '"
254 << rmd->getStartBodyLine() << "';\n";
255
256 QCString scope = rmd->getScopeString();
257 QCString name = rmd->name();
258 if (!scope.isEmpty() && scope!=def->name())
259 {
260 name.prepend(scope+"::");
261 }
262
263 t << refPrefix << "name = ";
264 writeDEFString(t,name);
265 t << ';' << "\n };\n";
266 }
267 }
268 auto refByList = md->getReferencedByMembers();
269 for (const auto &rmd : refByList)
270 {
271 if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef())
272 {
273 t << memPrefix << "referencedby = {\n";
274 t << refPrefix << "id = '"
275 << rmd->getBodyDef()->getOutputFileBase()
276 << "_1" // encoded ':' character (see util.cpp:convertNameToFile)
277 << rmd->anchor() << "';\n";
278
279 t << refPrefix << "line = '"
280 << rmd->getStartBodyLine() << "';\n";
281
282 QCString scope = rmd->getScopeString();
283 QCString name = rmd->name();
284 if (!scope.isEmpty() && scope!=def->name())
285 {
286 name.prepend(scope+"::");
287 }
288
289 t << refPrefix << "name = ";
290 writeDEFString(t,name);
291 t << ';' << "\n };\n";
292 }
293 }
294
295 t << " }; /* " << prefix << "-member */\n";
296}
constexpr auto prefix
Definition anchor.cpp:44
This class represents an function or template argument list.
Definition arguments.h:60
iterator end()
Definition arguments.h:87
iterator begin()
Definition arguments.h:86
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual QCString anchor() const =0
virtual const MemberVector & getReferencedByMembers() const =0
virtual const MemberVector & getReferencesMembers() const =0
virtual QCString typeString() const =0
virtual const ClassDef * getClassDef() const =0
virtual const MemberVector & enumFieldList() const =0
virtual const ArgumentList & argumentList() const =0
virtual const NamespaceDef * getNamespaceDef() const =0
virtual Protection protection() const =0
virtual MemberType memberType() const =0
virtual QCString argsString() const =0
virtual Specifier virtualness(int count=0) const =0
virtual const QCString & initializer() const =0
QCString & prepend(const char *s)
Definition qcstring.h:407
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString & append(char c)
Definition qcstring.h:381
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars=nullptr)
Definition defargs.l:814
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
#define ASSERT(x)
Definition qcstring.h:39
This class contains the information about the argument of a function or template.
Definition arguments.h:27
QCString name
Definition arguments.h:39
@ Enumeration
Definition types.h:395
@ EnumValue
Definition types.h:396
@ Dictionary
Definition types.h:406
@ Interface
Definition types.h:403
@ Sequence
Definition types.h:405
@ Variable
Definition types.h:393
@ Property
Definition types.h:401
@ Typedef
Definition types.h:394
@ Function
Definition types.h:392
@ Service
Definition types.h:404
QCString replaceAnonymousScopes(const QCString &s, const QCString &replacement)
Definition util.cpp:229

References Definition::anchor(), QCString::append(), MemberDef::argsString(), MemberDef::argumentList(), ASSERT, ArgumentList::begin(), Definition::briefDescription(), DCOP, Define, Dictionary, Definition::documentation(), ArgumentList::end(), Enumeration, MemberDef::enumFieldList(), EnumValue, Event, FALSE, Friend, Function, MemberDef::getClassDef(), Definition::getDefFileName(), Definition::getDefLine(), Definition::getLanguage(), MemberDef::getNamespaceDef(), Definition::getOutputFileBase(), Definition::getReferencedByMembers(), Definition::getReferencesMembers(), MemberDef::initializer(), Interface, QCString::isEmpty(), MemberDef::memberType(), Argument::name, Definition::name(), Normal, Package, prefix, QCString::prepend(), Private, Property, Protected, MemberDef::protection(), Public, Pure, replaceAnonymousScopes(), Sequence, Service, Signal, Slot, stringToArgumentList(), TRUE, Typedef, MemberDef::typeString(), Variable, Virtual, MemberDef::virtualness(), and writeDEFString().

Referenced by generateDEFClassSection(), and generateDEFSection().

◆ generateDEFForNamespace()

static void generateDEFForNamespace ( const NamespaceDef * nd,
TextStream & t )
static

Definition at line 465 of file defgen.cpp.

466{
467 if (nd->isReference()) return; // skip external references
468 t << " namespace = {\n";
469 t << " ns-id = '" << nd->getOutputFileBase() << "';\n";
470 t << " ns-name = ";
471 writeDEFString(t,nd->name());
472 t << ";\n";
473
474 generateDEFSection(nd,t,nd->getMemberList(MemberListType::DecDefineMembers()),"define");
475 generateDEFSection(nd,t,nd->getMemberList(MemberListType::DecProtoMembers()),"prototype");
476 generateDEFSection(nd,t,nd->getMemberList(MemberListType::DecTypedefMembers()),"typedef");
477 generateDEFSection(nd,t,nd->getMemberList(MemberListType::DecSequenceMembers()),"sequence");
478 generateDEFSection(nd,t,nd->getMemberList(MemberListType::DecDictionaryMembers()),"dictionary");
479 generateDEFSection(nd,t,nd->getMemberList(MemberListType::DecEnumMembers()),"enum");
480 generateDEFSection(nd,t,nd->getMemberList(MemberListType::DecFuncMembers()),"func");
481 generateDEFSection(nd,t,nd->getMemberList(MemberListType::DecVarMembers()),"var");
482
483 t << " ns-filename = '" << nd->getDefFileName() << "';\n";
484 t << " ns-fileline = '" << nd->getDefLine() << "';\n";
485 t << " ns-briefdesc = <<_EnD_oF_dEf_TeXt_\n"
486 << nd->briefDescription() << "\n_EnD_oF_dEf_TeXt_;\n";
487
488 t << " ns-documentation = <<_EnD_oF_dEf_TeXt_\n"
489 << nd->documentation() << "\n_EnD_oF_dEf_TeXt_;\n";
490 t << " };\n";
491}
virtual MemberList * getMemberList(MemberListType lt) const =0

References Definition::briefDescription(), Definition::documentation(), generateDEFSection(), Definition::getDefFileName(), Definition::getDefLine(), NamespaceDef::getMemberList(), Definition::getOutputFileBase(), Definition::isReference(), Definition::name(), and writeDEFString().

Referenced by generateDEF().

◆ generateDEFSection()

static void generateDEFSection ( const Definition * d,
TextStream & t,
const MemberList * ml,
const QCString & kind )
static

Definition at line 449 of file defgen.cpp.

453{
454 if (ml && !ml->empty())
455 {
456 t << " " << kind << " = {\n";
457 for (const auto &md : *ml)
458 {
459 generateDEFForMember(md,t,d,kind);
460 }
461 t << " };\n";
462 }
463}

References MemberVector::empty(), and generateDEFForMember().

Referenced by generateDEFForFile(), and generateDEFForNamespace().

◆ writeDEFString()

static void writeDEFString ( TextStream & t,
const QCString & s )
inlinestatic

Definition at line 42 of file defgen.cpp.

43{
44 t << '\'';
45 if (!s.isEmpty())
46 {
47 const char* p=s.data();
48 char c = 0;
49
50 while ((c = *(p++)))
51 {
52 if (c == '\'') t << '\\';
53 t << c;
54 }
55 }
56 t << '\'';
57}
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159

References QCString::data(), and QCString::isEmpty().

Referenced by generateDEFForFile(), generateDEFForMember(), and generateDEFForNamespace().