Doxygen
Loading...
Searching...
No Matches
perlmodgen.cpp File Reference
#include "perlmodgen.h"
#include <iostream>
#include <variant>
#include "arguments.h"
#include "classdef.h"
#include "classlist.h"
#include "conceptdef.h"
#include "config.h"
#include "construct.h"
#include "dir.h"
#include "docnode.h"
#include "docparser.h"
#include "docvisitor.h"
#include "doxygen.h"
#include "emoji.h"
#include "filename.h"
#include "groupdef.h"
#include "htmlentity.h"
#include "membergroup.h"
#include "memberlist.h"
#include "membername.h"
#include "message.h"
#include "moduledef.h"
#include "namespacedef.h"
#include "pagedef.h"
#include "portable.h"
#include "util.h"
Include dependency graph for perlmodgen.cpp:

Go to the source code of this file.

Classes

class  PerlModOutputStream
class  PerlModOutput
class  PerlModDocVisitor
 Concrete visitor implementation for PerlMod output. More...
class  PerlModGenerator

Macros

#define PERLOUTPUT_MAX_INDENTATION   40

Functions

static void addTemplateArgumentList (const ArgumentList &al, PerlModOutput &output, const DString &, const ArgumentList &typeConstraints=ArgumentList())
static void addTemplateList (const ClassDef *cd, PerlModOutput &output)
static void addTemplateList (const ConceptDef *cd, PerlModOutput &output)
static void addPerlModDocBlock (PerlModOutput &output, const DString &name, const DString &fileName, int lineNr, const Definition *scope, const MemberDef *md, const DString &text)
static const char * getProtectionName (Protection prot)
static const char * getVirtualnessName (Specifier virt)
void setPerlModDoxyfile (const DString &qs)
void generatePerlMod ()

Variables

static DString pathDoxyfile
static DString pathDoxyExec

Macro Definition Documentation

◆ PERLOUTPUT_MAX_INDENTATION

#define PERLOUTPUT_MAX_INDENTATION   40

Definition at line 50 of file perlmodgen.cpp.

Referenced by PerlModOutput::decIndent(), and PerlModOutput::incIndent().

Function Documentation

◆ addPerlModDocBlock()

void addPerlModDocBlock ( PerlModOutput & output,
const DString & name,
const DString & fileName,
int lineNr,
const Definition * scope,
const MemberDef * md,
const DString & text )
static

Definition at line 1399 of file perlmodgen.cpp.

1406{
1407 DString stext = text.stripWhiteSpace();
1408 if (stext.empty())
1409 {
1410 output.addField(name).add("{}");
1411 }
1412 else
1413 {
1414 auto parser { createDocParser() };
1415 auto ast { validatingParseDoc(*parser.get(),
1416 fileName,
1417 lineNr,
1418 scope,
1419 md,
1420 stext,
1421 DocOptions())
1422 };
1423 output.openHash(name);
1424 auto astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
1425 if (astImpl)
1426 {
1427 PerlModDocVisitor visitor(output);
1428 std::visit(visitor,astImpl->root);
1429 visitor.finish();
1430 }
1431 output.closeHash();
1432 }
1433}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
Class representing the abstract syntax tree of a documentation block.
Definition docnode.h:1471
Concrete visitor implementation for PerlMod output.
PerlModOutput & add(char c)
PerlModOutput & openHash(const DString &s=DString())
PerlModOutput & closeHash()
PerlModOutput & addField(const DString &s)
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:59
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
Helper class to pass options when calling OutputList::generateDoc().
Definition docoptions.h:24

References PerlModOutput::add(), PerlModOutput::addField(), PerlModOutput::closeHash(), createDocParser(), DString::empty(), PerlModDocVisitor::finish(), PerlModOutput::openHash(), DString::stripWhiteSpace(), and validatingParseDoc().

Referenced by PerlModGenerator::generatePerlModForClass(), PerlModGenerator::generatePerlModForConcept(), PerlModGenerator::generatePerlModForFile(), PerlModGenerator::generatePerlModForGroup(), PerlModGenerator::generatePerlModForMember(), PerlModGenerator::generatePerlModForModule(), PerlModGenerator::generatePerlModForNamespace(), and PerlModGenerator::generatePerlModForPage().

◆ addTemplateArgumentList()

void addTemplateArgumentList ( const ArgumentList & al,
PerlModOutput & output,
const DString & ,
const ArgumentList & typeConstraints = ArgumentList() )
static

Definition at line 1356 of file perlmodgen.cpp.

1358{
1359 if (!al.hasParameters()) return;
1360 output.openList("template_parameters");
1361 for (const Argument &a : al)
1362 {
1363 output.openHash();
1364 if (!a.type.empty())
1365 output.addFieldQuotedString("type", a.type);
1366 if (!a.name.empty())
1367 output.addFieldQuotedString("declaration_name", a.name)
1368 .addFieldQuotedString("definition_name", a.name);
1369 if (!a.defval.empty())
1370 output.addFieldQuotedString("default", a.defval);
1371 DString typeConstraint = a.typeConstraint;
1372 // C# where clauses, with one entry per constraint. A C# type parameter has its name in type.
1373 const DString &paramName = a.name.empty() ? a.type : a.name;
1374 for (const Argument &tc : typeConstraints)
1375 {
1376 if (tc.name==paramName && !tc.type.empty())
1377 {
1378 if (!typeConstraint.empty()) typeConstraint+=", ";
1379 typeConstraint+=tc.type;
1380 }
1381 }
1382 if (!typeConstraint.empty())
1383 output.addFieldQuotedString("type_constraint", typeConstraint);
1384 output.closeHash();
1385 }
1386 output.closeList();
1387}
This class contains the information about the argument of a function or template.
Definition arguments.h:27
bool hasParameters() const
Definition arguments.h:77
PerlModOutput & closeList()
PerlModOutput & addFieldQuotedString(const DString &field, const DString &content)
PerlModOutput & openList(const DString &s=DString())

References PerlModOutput::addFieldQuotedString(), PerlModOutput::closeHash(), PerlModOutput::closeList(), DString::empty(), ArgumentList::hasParameters(), PerlModOutput::openHash(), and PerlModOutput::openList().

Referenced by addTemplateList(), and addTemplateList().

◆ addTemplateList() [1/2]

void addTemplateList ( const ClassDef * cd,
PerlModOutput & output )
static

Definition at line 1389 of file perlmodgen.cpp.

1390{
1392}
virtual const ArgumentList & templateArguments() const =0
Returns the template arguments of this class.
virtual const ArgumentList & typeConstraints() const =0
virtual const DString & name() const =0
static void addTemplateArgumentList(const ArgumentList &al, PerlModOutput &output, const DString &, const ArgumentList &typeConstraints=ArgumentList())

References addTemplateArgumentList(), Definition::name(), ClassDef::templateArguments(), and ClassDef::typeConstraints().

Referenced by PerlModGenerator::generatePerlModForClass(), and PerlModGenerator::generatePerlModForConcept().

◆ addTemplateList() [2/2]

void addTemplateList ( const ConceptDef * cd,
PerlModOutput & output )
static

Definition at line 1394 of file perlmodgen.cpp.

1395{
1397}
virtual ArgumentList getTemplateParameterList() const =0

References addTemplateArgumentList(), ConceptDef::getTemplateParameterList(), and Definition::name().

◆ generatePerlMod()

void generatePerlMod ( )

Definition at line 2985 of file perlmodgen.cpp.

2986{
2987 PerlModGenerator pmg(Config_getBool(PERLMOD_PRETTY));
2988 pmg.generate();
2989}
#define Config_getBool(name)
Definition config.h:33

References Config_getBool, and PerlModGenerator::generate().

Referenced by generateOutput().

◆ getProtectionName()

const char * getProtectionName ( Protection prot)
static

Definition at line 1435 of file perlmodgen.cpp.

1436{
1437 return to_string_lower(prot);
1438}

Referenced by PerlModGenerator::addListOfAllMembers(), PerlModGenerator::generatePerlModForClass(), and PerlModGenerator::generatePerlModForMember().

◆ getVirtualnessName()

const char * getVirtualnessName ( Specifier virt)
static

Definition at line 1440 of file perlmodgen.cpp.

1441{
1442 return to_string_lower(virt);
1443}

Referenced by PerlModGenerator::addListOfAllMembers(), PerlModGenerator::generatePerlModForClass(), and PerlModGenerator::generatePerlModForMember().

◆ setPerlModDoxyfile()

void setPerlModDoxyfile ( const DString & qs)

Definition at line 1448 of file perlmodgen.cpp.

1449{
1450 pathDoxyfile = qs;
1452}
static std::string currentDirPath()
Definition dir.cpp:347
static DString pathDoxyExec
static DString pathDoxyfile

References Dir::currentDirPath(), pathDoxyExec, and pathDoxyfile.

Referenced by readConfiguration().

Variable Documentation

◆ pathDoxyExec

DString pathDoxyExec
static

Definition at line 1446 of file perlmodgen.cpp.

Referenced by PerlModGenerator::generateDoxyRules(), and setPerlModDoxyfile().

◆ pathDoxyfile

DString pathDoxyfile
static

Definition at line 1445 of file perlmodgen.cpp.

Referenced by PerlModGenerator::generateDoxyRules(), and setPerlModDoxyfile().