LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
HandlerStreamBuf.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 "HandlerStreamBuf.h"
11
12#define BUFFER_SIZE 4096
13
14using namespace std;
15
16namespace Lima{
17
18
20 m_handler(handler)
21{
22 m_pbuf = new char[BUFFER_SIZE];
23 setp(m_pbuf,m_pbuf+BUFFER_SIZE);
24}
25
26
28{
29 sync();
30 delete [] m_pbuf;
31}
32
34{
35 if (sync()) return EOF;
36 if (c != EOF)
37 {
38 char cbuf[1];
39 cbuf[0] = c;
40 m_handler->handle(cbuf,1);
41 }
42 return 0;
43}
44
46{
47 if (pbase()!=pptr())
48 {
50 }
51 return 0;
52}
53
55{
56 streamsize len = (pptr() - pbase());
57 m_handler->handle(pbase(),len);
58 setp(pbase(), epptr());
59}
60
61
62}
#define BUFFER_SIZE
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...
HandlerStreamBuf(AbstractAnalysisHandler *handler)
int overflow(int c) override
NAUTITIA.
STL namespace.