Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
docvisitor.cpp
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2020 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*/
14
15
// own header
16
#include "
docvisitor.h
"
17
18
// standard includes
19
#include <stack>
20
#include <unordered_map>
21
22
// other includes
23
#include "
doxygen.h
"
24
#include "
parserintf.h
"
25
#include "
types.h
"
26
#include "
util.h
"
27
28
struct
DocVisitor::Private
29
{
30
int
id
;
31
std::unordered_map< std::string, std::unique_ptr<CodeParserInterface> >
parserFactoryMap
;
32
std::stack<bool>
hidden
;
33
};
34
35
DocVisitor::DocVisitor
() :
m_p
(
std
::make_unique<
Private
>())
36
{
37
}
38
39
DocVisitor::~DocVisitor
()
40
{
41
}
42
43
CodeParserInterface
&
DocVisitor::getCodeParser
(
const
DString
&extension)
44
{
45
std::string ext = extension.
str
();
46
// for each extension we create a code parser once per visitor, so that
47
// the context of the same parser object is reused throughout multiple passes for instance
48
// for code fragments shown via dontinclude.
49
auto
it =
m_p
->parserFactoryMap.find(ext);
50
if
(it==
m_p
->parserFactoryMap.end())
51
{
52
auto
factory =
Doxygen::parserManager
->
getCodeParserFactory
(extension);
53
auto
result =
m_p
->parserFactoryMap.emplace(ext,factory());
54
it = result.first;
55
}
56
return
*it->second.get();
57
}
58
59
void
DocVisitor::pushHidden
(
bool
hide)
60
{
61
m_p
->hidden.push(hide);
62
}
63
64
bool
DocVisitor::popHidden
()
65
{
66
if
(
m_p
->hidden.empty())
return
false
;
67
bool
v =
m_p
->hidden.top();
68
m_p
->hidden.pop();
69
return
v;
70
}
CodeParserInterface
Abstract interface for code parsers.
Definition
parserintf.h:141
DString
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition
dstring.h:84
DString::str
const std::string & str() const
Definition
dstring.h:645
DocVisitor::~DocVisitor
virtual ~DocVisitor()
Definition
docvisitor.cpp:39
DocVisitor::pushHidden
void pushHidden(bool hide)
Definition
docvisitor.cpp:59
DocVisitor::m_p
std::unique_ptr< Private > m_p
Definition
docvisitor.h:39
DocVisitor::DocVisitor
DocVisitor()
Definition
docvisitor.cpp:35
DocVisitor::getCodeParser
CodeParserInterface & getCodeParser(const DString &langExt)
Definition
docvisitor.cpp:43
DocVisitor::popHidden
bool popHidden()
Definition
docvisitor.cpp:64
Doxygen::parserManager
static ParserManager * parserManager
Definition
doxygen.h:122
ParserManager::getCodeParserFactory
CodeParserFactory & getCodeParserFactory(const DString &extension)
Get the factory for create code parser objects with a given extension.
Definition
parserintf.h:259
docvisitor.h
doxygen.h
std
Definition
dstring.h:913
parserintf.h
DocVisitor::Private
Definition
docvisitor.cpp:29
DocVisitor::Private::parserFactoryMap
std::unordered_map< std::string, std::unique_ptr< CodeParserInterface > > parserFactoryMap
Definition
docvisitor.cpp:31
DocVisitor::Private::hidden
std::stack< bool > hidden
Definition
docvisitor.cpp:32
DocVisitor::Private::id
int id
Definition
docvisitor.cpp:30
types.h
This file contains a number of basic enums and types.
util.h
A bunch of utility functions.
src
docvisitor.cpp
Generated by
1.19.0