LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / helpcompiler / inc / BasCodeTagger.hxx
blobb873001e6960862b57ad6d8345a740324dd2be0b
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>
19 class LibXmlTreeWalker;
21 //!Tagger class.
22 class BasicCodeTagger
24 private:
25 xmlDocPtr m_pDocument;
26 std::vector<xmlNodePtr> m_BasicCodeContainerTags;
27 std::unique_ptr<LibXmlTreeWalker> m_pXmlTreeWalker;
28 SyntaxHighlighter m_Highlighter;
29 bool m_bTaggingCompleted;
30 void tagParagraph( xmlNodePtr paragraph );
31 static xmlChar* getTypeString( TokenType tokenType );
32 void getBasicCodeContainerNodes();
33 void tagBasCodeParagraphs();
35 public:
36 enum TaggerException { NULL_DOCUMENT, EMPTY_DOCUMENT };
37 BasicCodeTagger( xmlDocPtr rootDoc );
38 ~BasicCodeTagger();
39 void tagBasicCodes();
42 //================LibXmlTreeWalker===========================================================
44 class LibXmlTreeWalker
46 private:
47 xmlNodePtr m_pCurrentNode;
48 std::deque<xmlNodePtr> m_Queue; //!Queue for breath-first search
50 public:
51 LibXmlTreeWalker( xmlDocPtr doc );
52 void nextNode();
53 xmlNodePtr currentNode() { return m_pCurrentNode;}
54 bool end() const;
55 void ignoreCurrNodesChildren();
58 #endif
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */