2013-09-15 18:39:22 +01:00
|
|
|
#ifndef LATAN_SAMPLE_HPP_
|
|
|
|
#define LATAN_SAMPLE_HPP_
|
|
|
|
|
|
|
|
#include <latan/Global.hpp>
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
LATAN_BEGIN_CPPDECL
|
|
|
|
|
|
|
|
template <typename DataObj>
|
|
|
|
class ParserState
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor
|
2014-01-22 15:57:47 +00:00
|
|
|
explicit ParserState(std::istream *streamPt, std::string *namePt,
|
|
|
|
DataObj *dataPt);
|
2013-09-15 18:39:22 +01:00
|
|
|
// destructor
|
|
|
|
virtual ~ParserState(void);
|
2014-01-22 15:57:47 +00:00
|
|
|
private:
|
|
|
|
// scanner allocation/deallocation
|
|
|
|
virtual void initScanner(void) = 0;
|
|
|
|
virtual void destroyScanner(void) = 0;
|
|
|
|
public:
|
2013-09-15 18:39:22 +01:00
|
|
|
DataObj* data;
|
|
|
|
void* scanner;
|
|
|
|
std::istream* stream;
|
2014-01-22 15:57:47 +00:00
|
|
|
std::string* streamName;
|
|
|
|
|
2013-09-15 18:39:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <typename DataObj>
|
2014-01-22 15:57:47 +00:00
|
|
|
ParserState<DataObj>::ParserState(std::istream *streamPt, std::string *namePt,
|
|
|
|
DataObj *dataPt)
|
|
|
|
: data(dataPt)
|
|
|
|
, scanner(NULL)
|
|
|
|
, stream(streamPt)
|
|
|
|
, streamName(namePt)
|
2013-09-15 18:39:22 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
template <typename DataObj>
|
|
|
|
ParserState<DataObj>::~ParserState(void)
|
|
|
|
{}
|
|
|
|
|
|
|
|
LATAN_END_CPPDECL
|
|
|
|
|
|
|
|
#endif
|