LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
BowTextWriter.cpp
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/***************************************************************************
7 * Copyright (C) 2004-2012 by CEA LIST *
8 * *
9 ***************************************************************************/
10#include "BowTextWriter.h"
14
15using namespace std;
16
17namespace Lima {
18
19namespace LinguisticProcessing {
20
22
24{
25 friend class BowTextWriter;
26
27public:
29
30 virtual ~BowTextWriterPrivate();
31
32 std::ostream* m_out;
33};
34
38
42
43
48
50{
51 delete m_d;
52}
53
54void BowTextWriter::setOut(std::ostream* out)
55{
56 m_d->m_out = out;
57}
58
60{
61 if (m_d->m_out == nullptr)
62 {
64 LERROR << "BowTextWriter Error: output stream is not set !";
65 return;
66 }
67 m_d->m_out->flush();
68}
69
73
74void BowTextWriter::handle(const char* buf, int length)
75{
76 if (m_d->m_out == nullptr)
77 {
79 LERROR << "BowTextWriter Error: output stream is not set !";
80 return;
81 }
82 m_d->m_out->write(buf,length);
83}
84
86{
88 LDEBUG << "BowTextWriter::startAnalysis";
89 if (m_d->m_out == nullptr)
90 {
92 LERROR << "BowTextWriter Error: output stream is not set !";
93 return;
94 }
97
98}
99
102
103void BowTextWriter::startNode( const std::string& , bool )
104{}
105
108
109}
110
111}
#define BOWTEXTWRITER_CLASSID
#define LDEBUG
Definition LimaCommon.h:157
#define LERROR
Definition LimaCommon.h:161
#define BOWLOGINIT
Definition LimaCommon.h:201
Defines a Factory to create Object of type Base.
void writeHeader(std::ostream &file, BoWFileType type) const
virtual void startDocument(const Common::Misc::GenericDocumentProperties &props) override
notify the start of a new document, and give its properties
void setOut(std::ostream *out) override
set the output stream.
virtual void endDocument() override
notify the end of the document
virtual void startAnalysis() override
function called by the LIMA analyzer on start of a new document
virtual void handle(const char *buf, int length) override
gives content.
virtual void startNode(const std::string &elementName, bool forIndexing) override
notify the start of a new hierarchyNode
virtual void endAnalysis() override
function called by the LIMA analyzer on the end of a text part that is to be analyzed
virtual void endNode(const Common::Misc::GenericDocumentProperties &props) override
notify the end of a hierarchyNode
SimpleFactory< AbstractResource, BowTextWriter > bowTextWriterFactory(BOWTEXTWRITER_CLASSID)
NAUTITIA.
STL namespace.