LibreOffice Module helpcompiler (master) 1
BasCodeTagger.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10#pragma once
11
12#include <deque>
13#include <memory>
14#include <vector>
15#include <libxml/parser.h>
17
19
22{
23 private:
24 xmlDocPtr m_pDocument;
25 std::vector<xmlNodePtr> m_BasicCodeContainerTags;
26 std::unique_ptr<LibXmlTreeWalker> m_pXmlTreeWalker;
29 void tagParagraph( xmlNodePtr paragraph );
30 static xmlChar* getTypeString( TokenType tokenType );
33
34 public:
36 BasicCodeTagger( xmlDocPtr rootDoc );
38 void tagBasicCodes();
39};
40
41//================LibXmlTreeWalker===========================================================
42
44{
45 private:
46 xmlNodePtr m_pCurrentNode;
47 std::deque<xmlNodePtr> m_Queue;
48
49 public:
50 LibXmlTreeWalker( xmlDocPtr doc );
51 void nextNode();
52 xmlNodePtr currentNode() { return m_pCurrentNode;}
53 bool end() const;
55};
56
57/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Tagger class.
std::unique_ptr< LibXmlTreeWalker > m_pXmlTreeWalker
BasicCodeTagger(xmlDocPtr rootDoc)
xmlDocPtr m_pDocument
void tagBasCodeParagraphs()
Extracts Basic Codes contained in <bascode> tags.
std::vector< xmlNodePtr > m_BasicCodeContainerTags
static xmlChar * getTypeString(TokenType tokenType)
Converts SyntaxHighlighter's TokenTypes enum to a type string for
void getBasicCodeContainerNodes()
Gathers all the <bascode> tag nodes from xml tree.
void tagBasicCodes()
Manages tagging process.
SyntaxHighlighter m_Highlighter
void tagParagraph(xmlNodePtr paragraph)
Used by tagBasCodeParagraphs(). It does the work on the current paragraph containing Basic code.
xmlNodePtr currentNode()
xmlNodePtr m_pCurrentNode
LibXmlTreeWalker(xmlDocPtr doc)
Queue for breath-first search.
void ignoreCurrNodesChildren()
std::deque< xmlNodePtr > m_Queue
bool end() const
TokenType