LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
AbstractAnalysisHandler.h
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6#ifndef ABSTRACTANALYSISHANDLER_H
7#define ABSTRACTANALYSISHANDLER_H
8
9#include <sstream>
11
12namespace Lima {
13
23{
24public:
25
27
40// virtual void startDocument(const Common::Misc::GenericDocumentProperties& props) = 0;
41
45// virtual void endDocument() = 0;
46
51 virtual void startAnalysis() = 0;
52
53// virtual void startAnalysis(std::string bloc_type) {startAnalysis();};
54
65 virtual void handle(const char* buf,int length) =0;
66
71 virtual void endAnalysis() = 0;
72
78// virtual void startNode( const std::string& elementName, bool forIndexing ) = 0;
79
84// virtual void endNode( const Common::Misc::GenericDocumentProperties& props ) = 0;
85
86};
87
88
89
90
92{
93 public:
94 AnalysisHandlerContainer ( std::map<std::string, AbstractAnalysisHandler*>& handlers ) : AnalysisData(),m_handlers ( handlers ) {};
95 AbstractAnalysisHandler* getHandler(const std::string& handlerId) const {
96 if (m_handlers.find(handlerId) != m_handlers.end())
97 return m_handlers[handlerId];
98 else
99 return 0;
100 };
101 private:
102 AnalysisHandlerContainer& operator=(const AnalysisHandlerContainer&) {return *this;}
103 std::map<std::string, AbstractAnalysisHandler*>& m_handlers;
104};
105
106} // Lima
107
108#endif
The AbstractAnalysisHandler class defines the callback interface: the functions that are to be define...
virtual void handle(const char *buf, int length)=0
main function of the handler: handle data produced by the dumper at end of the analysis of a given te...
virtual void startAnalysis()=0
function called by the LIMA analyzer on start of a new document
virtual void endAnalysis()=0
function called by the LIMA analyzer on the end of a text part that is to be analyzed
just for semantics: base class for analysisData
AnalysisHandlerContainer(std::map< std::string, AbstractAnalysisHandler * > &handlers)
AbstractAnalysisHandler * getHandler(const std::string &handlerId) const
NAUTITIA.