68 lines
1.2 KiB
C++
68 lines
1.2 KiB
C++
#ifndef _HTTP_EMIT_HPP_
|
|
#define _HTTP_EMIT_HPP_
|
|
#ifndef _COMMON_STRING_HPP_
|
|
#include <common/string.hpp>
|
|
#endif
|
|
#ifndef _COMMON_PUREVIEWOFFILE_HPP_
|
|
#include <common/pview.hpp>
|
|
#endif
|
|
|
|
class Emit
|
|
{
|
|
friend class Scan;
|
|
friend class Parse;
|
|
public:
|
|
void emit(const char *lpLiteralValue)const;
|
|
void emit(const String &literalValue)const;
|
|
void emit(int code,int type,int identifier)const;
|
|
void emit(int code)const;
|
|
void emit(int code,double value)const;
|
|
void emit(int code,int op)const;
|
|
int read(void);
|
|
int read(void *variable,size_t size);
|
|
void emitting(int);
|
|
int emitting(void)const;
|
|
private:
|
|
Emit(PureViewOfFile &inputView,PureViewOfFile &outputView);
|
|
virtual ~Emit();
|
|
|
|
int mIsEmitting;
|
|
char mLastSymbol;
|
|
PureViewOfFile &mInputView;
|
|
PureViewOfFile &mOutputView;
|
|
};
|
|
|
|
inline
|
|
void Emit::emitting(int isEmitting)
|
|
{
|
|
mIsEmitting=isEmitting;
|
|
}
|
|
|
|
inline
|
|
int Emit::emitting(void)const
|
|
{
|
|
return mIsEmitting;
|
|
}
|
|
|
|
inline
|
|
void Emit::emit(int code)const
|
|
{
|
|
if(!mIsEmitting)return;
|
|
mOutputView.write(code);
|
|
}
|
|
|
|
inline
|
|
int Emit::read(void)
|
|
{
|
|
if(!mInputView.read((unsigned char&)mLastSymbol))return 0xFFFF;
|
|
return mLastSymbol;
|
|
}
|
|
|
|
inline
|
|
int Emit::read(void *variable,size_t size)
|
|
{
|
|
if(!mInputView.read((char*)variable,size))return 0xFFFF;
|
|
return 0;
|
|
}
|
|
#endif
|