d8282c9adc
Change-Id: I8d65947f3188ab7b54653eee887de2c5d4f8095d Reviewed-on: https://gerrit.libreoffice.org/45290 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
66 lines
1.8 KiB
C++
66 lines
1.8 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#ifndef INCLUDED_HELPCOMPILER_INC_BASCODETAGGER_HXX
|
|
#define INCLUDED_HELPCOMPILER_INC_BASCODETAGGER_HXX
|
|
|
|
#include <iostream>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <deque>
|
|
#include <vector>
|
|
#include <libxml/xmlmemory.h>
|
|
#include <libxml/parser.h>
|
|
#include <rtl/ustring.hxx>
|
|
#include <comphelper/syntaxhighlight.hxx>
|
|
#include <helpcompiler/dllapi.h>
|
|
|
|
class BasicCodeTagger;
|
|
class LibXmlTreeWalker;
|
|
|
|
//!Tagger class.
|
|
class L10N_DLLPUBLIC BasicCodeTagger
|
|
{
|
|
private:
|
|
xmlDocPtr m_pDocument;
|
|
std::vector<xmlNodePtr> m_BasicCodeContainerTags;
|
|
LibXmlTreeWalker *m_pXmlTreeWalker;
|
|
SyntaxHighlighter m_Highlighter;
|
|
bool m_bTaggingCompleted;
|
|
void tagParagraph( xmlNodePtr paragraph );
|
|
static xmlChar* getTypeString( TokenType tokenType );
|
|
void getBasicCodeContainerNodes();
|
|
void tagBasCodeParagraphs();
|
|
|
|
public:
|
|
enum TaggerException { NULL_DOCUMENT, EMPTY_DOCUMENT };
|
|
BasicCodeTagger( xmlDocPtr rootDoc );
|
|
~BasicCodeTagger();
|
|
void tagBasicCodes();
|
|
};
|
|
|
|
//================LibXmlTreeWalker===========================================================
|
|
|
|
class L10N_DLLPUBLIC LibXmlTreeWalker
|
|
{
|
|
private:
|
|
xmlNodePtr m_pCurrentNode;
|
|
std::deque<xmlNodePtr> m_Queue; //!Queue for breath-first search
|
|
|
|
public:
|
|
LibXmlTreeWalker( xmlDocPtr doc );
|
|
void nextNode();
|
|
xmlNodePtr currentNode() { return m_pCurrentNode;}
|
|
bool end() const;
|
|
void ignoreCurrNodesChildren();
|
|
};
|
|
|
|
#endif
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|