Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / helpcompiler / inc / BasCodeTagger.hxx
blobd897afb4fe1d12c581a74835858e86795e92341f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_HELPCOMPILER_INC_BASCODETAGGER_HXX
11 #define INCLUDED_HELPCOMPILER_INC_BASCODETAGGER_HXX
13 #include <deque>
14 #include <memory>
15 #include <vector>
16 #include <libxml/parser.h>
17 #include <comphelper/syntaxhighlight.hxx>
18 #include <helpcompiler/dllapi.h>
20 class LibXmlTreeWalker;
22 //!Tagger class.
23 class BasicCodeTagger
25 private:
26 xmlDocPtr m_pDocument;
27 std::vector<xmlNodePtr> m_BasicCodeContainerTags;
28 std::unique_ptr<LibXmlTreeWalker> m_pXmlTreeWalker;
29 SyntaxHighlighter m_Highlighter;
30 bool m_bTaggingCompleted;
31 void tagParagraph( xmlNodePtr paragraph );
32 static xmlChar* getTypeString( TokenType tokenType );
33 void getBasicCodeContainerNodes();
34 void tagBasCodeParagraphs();
36 public:
37 enum TaggerException { NULL_DOCUMENT, EMPTY_DOCUMENT };
38 BasicCodeTagger( xmlDocPtr rootDoc );
39 ~BasicCodeTagger();
40 void tagBasicCodes();
43 //================LibXmlTreeWalker===========================================================
45 class LibXmlTreeWalker
47 private:
48 xmlNodePtr m_pCurrentNode;
49 std::deque<xmlNodePtr> m_Queue; //!Queue for breath-first search
51 public:
52 LibXmlTreeWalker( xmlDocPtr doc );
53 void nextNode();
54 xmlNodePtr currentNode() { return m_pCurrentNode;}
55 bool end() const;
56 void ignoreCurrNodesChildren();
59 #endif
61 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */