Doxygen
Loading...
Searching...
No Matches
perlmodgen.cpp File Reference
#include <stdlib.h>
#include <stack>
#include "perlmodgen.h"
#include "docparser.h"
#include "docnode.h"
#include "message.h"
#include "doxygen.h"
#include "pagedef.h"
#include "memberlist.h"
#include "arguments.h"
#include "config.h"
#include "groupdef.h"
#include "classdef.h"
#include "conceptdef.h"
#include "classlist.h"
#include "filename.h"
#include "membername.h"
#include "namespacedef.h"
#include "membergroup.h"
#include "section.h"
#include "docvisitor.h"
#include "util.h"
#include "htmlentity.h"
#include "emoji.h"
#include "dir.h"
#include "portable.h"
#include "moduledef.h"
#include "construct.h"
#include "cite.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 48 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 1384 of file perlmodgen.cpp.

1391{
1392 DString stext = text.stripWhiteSpace();
1393 if (stext.empty())
1394 {
1395 output.addField(name).add("{}");
1396 }
1397 else
1398 {
1399 auto parser { createDocParser() };
1400 auto ast { validatingParseDoc(*parser.get(),
1401 fileName,
1402 lineNr,
1403 scope,
1404 md,
1405 stext,
1406 DocOptions())
1407 };
1408 output.openHash(name);
1409 auto astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
1410 if (astImpl)
1411 {
1412 PerlModDocVisitor visitor(output);
1413 std::visit(visitor,astImpl->root);
1414 visitor.finish();
1415 }
1416 output.closeHash();
1417 }
1418}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:88
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:152
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:341
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 1355 of file perlmodgen.cpp.

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

1375{
1377}
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 1379 of file perlmodgen.cpp.

1380{
1382}
virtual ArgumentList getTemplateParameterList() const =0

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

◆ generatePerlMod()

void generatePerlMod ( )

Definition at line 2953 of file perlmodgen.cpp.

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

1421{
1422 return to_string_lower(prot);
1423}

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

◆ getVirtualnessName()

const char * getVirtualnessName ( Specifier virt)
static

Definition at line 1425 of file perlmodgen.cpp.

1426{
1427 return to_string_lower(virt);
1428}

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

◆ setPerlModDoxyfile()

void setPerlModDoxyfile ( const DString & qs)

Definition at line 1433 of file perlmodgen.cpp.

1434{
1435 pathDoxyfile = qs;
1437}
static std::string currentDirPath()
Definition dir.cpp:343
static DString pathDoxyExec
static DString pathDoxyfile

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

Referenced by readConfiguration().

Variable Documentation

◆ pathDoxyExec

DString pathDoxyExec
static

Definition at line 1431 of file perlmodgen.cpp.

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

◆ pathDoxyfile

DString pathDoxyfile
static

Definition at line 1430 of file perlmodgen.cpp.

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