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// 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
29{
30 int id;
31 std::unordered_map< std::string, std::unique_ptr<CodeParserInterface> > parserFactoryMap;
32 std::stack<bool> hidden;
33};
34
36{
37}
38
42
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
60{
61 m_p->hidden.push(hide);
62}
63
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}
Abstract interface for code parsers.
Definition parserintf.h:141
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
const std::string & str() const
Definition dstring.h:645
virtual ~DocVisitor()
void pushHidden(bool hide)
std::unique_ptr< Private > m_p
Definition docvisitor.h:39
CodeParserInterface & getCodeParser(const DString &langExt)
bool popHidden()
static ParserManager * parserManager
Definition doxygen.h:122
CodeParserFactory & getCodeParserFactory(const DString &extension)
Get the factory for create code parser objects with a given extension.
Definition parserintf.h:259
Definition dstring.h:913
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.