Doxygen
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
16#include <unordered_map>
17#include <stack>
18
19#include "parserintf.h"
20#include "docvisitor.h"
21#include "util.h"
22#include "types.h"
23#include "doxygen.h"
24
26{
27 int id;
28 std::unordered_map< std::string, std::unique_ptr<CodeParserInterface> > parserFactoryMap;
29 std::stack<bool> hidden;
30};
31
32DocVisitor::DocVisitor() : m_p(std::make_unique<Private>())
33{
34}
35
39
41{
42 std::string ext = extension.str();
43 // for each extension we create a code parser once per visitor, so that
44 // the context of the same parser object is reused throughout multiple passes for instance
45 // for code fragments shown via dontinclude.
46 auto it = m_p->parserFactoryMap.find(ext);
47 if (it==m_p->parserFactoryMap.end())
48 {
49 auto factory = Doxygen::parserManager->getCodeParserFactory(extension);
50 auto result = m_p->parserFactoryMap.emplace(ext,factory());
51 it = result.first;
52 }
53 return *it->second.get();
54}
55
57{
58 m_p->hidden.push(hide);
59}
60
62{
63 if (m_p->hidden.empty()) return false;
64 bool v = m_p->hidden.top();
65 m_p->hidden.pop();
66 return v;
67}
Abstract interface for code parsers.
Definition parserintf.h:83
CodeParserInterface & getCodeParser(const QCString &langExt)
virtual ~DocVisitor()
void pushHidden(bool hide)
std::unique_ptr< Private > m_p
Definition docvisitor.h:31
bool popHidden()
static ParserManager * parserManager
Definition doxygen.h:131
This is an alternative implementation of QCString.
Definition qcstring.h:101
const std::string & str() const
Definition qcstring.h:537
std::unordered_map< std::string, std::unique_ptr< CodeParserInterface > > parserFactoryMap
std::stack< bool > hidden
This file contains a number of basic enums and types.
A bunch of utility functions.