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 &)
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 1385 of file perlmodgen.cpp.

1392{
1393 DString stext = text.stripWhiteSpace();
1394 if (stext.empty())
1395 {
1396 output.addField(name).add("{}");
1397 }
1398 else
1399 {
1400 auto parser { createDocParser() };
1401 auto ast { validatingParseDoc(*parser.get(),
1402 fileName,
1403 lineNr,
1404 scope,
1405 md,
1406 stext,
1407 DocOptions())
1408 };
1409 output.openHash(name);
1410 auto astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
1411 if (astImpl)
1412 {
1413 PerlModDocVisitor visitor(output);
1414 std::visit(visitor,astImpl->root);
1415 visitor.finish();
1416 }
1417 output.closeHash();
1418 }
1419}
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 &  )
static

Definition at line 1356 of file perlmodgen.cpp.

1357{
1358 if (!al.hasParameters()) return;
1359 output.openList("template_parameters");
1360 for (const Argument &a : al)
1361 {
1362 output.openHash();
1363 if (!a.type.empty())
1364 output.addFieldQuotedString("type", a.type);
1365 if (!a.name.empty())
1366 output.addFieldQuotedString("declaration_name", a.name)
1367 .addFieldQuotedString("definition_name", a.name);
1368 if (!a.defval.empty())
1369 output.addFieldQuotedString("default", a.defval);
1370 output.closeHash();
1371 }
1372 output.closeList();
1373}
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(), 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 1375 of file perlmodgen.cpp.

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

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

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

◆ addTemplateList() [2/2]

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

Definition at line 1380 of file perlmodgen.cpp.

1381{
1383}
virtual ArgumentList getTemplateParameterList() const =0

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

◆ generatePerlMod()

void generatePerlMod ( )

Definition at line 2954 of file perlmodgen.cpp.

2955{
2956 PerlModGenerator pmg(Config_getBool(PERLMOD_PRETTY));
2957 pmg.generate();
2958}
#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 1421 of file perlmodgen.cpp.

1422{
1423 return to_string_lower(prot);
1424}

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

◆ getVirtualnessName()

const char * getVirtualnessName ( Specifier virt)
static

Definition at line 1426 of file perlmodgen.cpp.

1427{
1428 return to_string_lower(virt);
1429}

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

◆ setPerlModDoxyfile()

void setPerlModDoxyfile ( const DString & qs)

Definition at line 1434 of file perlmodgen.cpp.

1435{
1436 pathDoxyfile = qs;
1438}
static std::string currentDirPath()
Definition dir.cpp:348
static DString pathDoxyExec
static DString pathDoxyfile

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

Referenced by readConfiguration().

Variable Documentation

◆ pathDoxyExec

DString pathDoxyExec
static

Definition at line 1432 of file perlmodgen.cpp.

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

◆ pathDoxyfile

DString pathDoxyfile
static

Definition at line 1431 of file perlmodgen.cpp.

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