Line data Source code
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 : #ifndef INCLUDED_HELPCOMPILER_INC_BASCODETAGGER_HXX
11 : #define INCLUDED_HELPCOMPILER_INC_BASCODETAGGER_HXX
12 :
13 : #include <iostream>
14 : #include <cstdlib>
15 : #include <string>
16 : #include <list>
17 : #include <libxml/xmlmemory.h>
18 : #include <libxml/parser.h>
19 : #include <rtl/ustring.hxx>
20 : #include <comphelper/syntaxhighlight.hxx>
21 : #include <helpcompiler/dllapi.h>
22 :
23 : class BasicCodeTagger;
24 : class LibXmlTreeWalker;
25 :
26 : //!Tagger class.
27 : class L10N_DLLPUBLIC BasicCodeTagger
28 : {
29 : private:
30 : xmlDocPtr m_pDocument;
31 : std::list<xmlNodePtr> m_BasicCodeContainerTags;
32 : LibXmlTreeWalker *m_pXmlTreeWalker;
33 : std::list<std::string> m_BasicCodeStringList;
34 : SyntaxHighlighter m_Highlighter;
35 : bool m_bTaggingCompleted;
36 : void tagParagraph( xmlNodePtr paragraph );
37 : static xmlChar* getTypeString( TokenTypes tokenType );
38 : void getBasicCodeContainerNodes();
39 : void tagBasCodeParagraphs();
40 :
41 : public:
42 : enum TaggerException { FILE_WRITING, NULL_DOCUMENT, EMPTY_DOCUMENT };
43 : BasicCodeTagger( xmlDocPtr rootDoc );
44 : ~BasicCodeTagger();
45 : void tagBasicCodes();
46 : };
47 :
48 : //================LibXmlTreeWalker===========================================================
49 :
50 : class L10N_DLLPUBLIC LibXmlTreeWalker
51 : {
52 : private:
53 : xmlNodePtr m_pCurrentNode;
54 : std::list<xmlNodePtr> m_Queue; //!Queue for breath-first search
55 :
56 : public:
57 : LibXmlTreeWalker( xmlDocPtr doc );
58 0 : ~LibXmlTreeWalker() {}
59 : void nextNode();
60 0 : xmlNodePtr currentNode() { return m_pCurrentNode;}
61 : bool end();
62 : void ignoreCurrNodesChildren();
63 : };
64 :
65 : #endif
66 :
67 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|