Files
harbour-core/harbour/samples/cccppc/reader.prg
1999-11-09 01:37:27 +00:00

97 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* $Id$
*/
//*******************************************************************
// reader.prg: A reader oszt ly implement ci¢ja.
// 1999, Csisz r Levente
//*******************************************************************
#include "objgen.ch"
//*******************************************************************
#include "tbuffer.och"
//*******************************************************************
#define _READER_PRG_
#define _IMPLEMENT_ONEW_
#include "reader.och"
//*******************************************************************
implement oinit(name,errorStream)
super:oinit()
this:name:=name
this:tbuffer:=C.TBUFFER:onew()
this:errorStream:=errorStream
return this
//*******************************************************************
implement read()
local w
if (nil!=(w:=TBUFFER.(this:tbuffer):get()))
return w
endif
return this:readItem()
//*******************************************************************
implement unread(item)
TBUFFER.(this:tbuffer):unget(item)
return nil
//*******************************************************************
implement readTBuffer()
return TBUFFER.(this:tbuffer):get()
//*******************************************************************
implement arrayTBuffer()
local i,r:={}
for i:=1 to TBUFFER.(this:tBuffer):bItemNumber
aadd(r,TBUFFER.(this:tBuffer):getBItem(i))
end for
return r
//*******************************************************************
implement isError(l)
if (empty(this:errorStream))
return .f.
endif
if (empty(l))
return .t.
endif
return len(this:errorStream)>l
//*******************************************************************
implement addError(prsErr)
if (this:errorStream!=nil)
aadd(this:errorStream,prsErr)
endif
return nil
//*******************************************************************
#ifdef OLD
implement errorStr()
local errStr
if (!this:isError())
return nil
endif
errStr:=""
if (!empty(this:error[1]))
errStr+=this:error[1]+": "
endif
errStr+=this:error[3]+", errCode: "+toStr(this:error[2])
return errStr
#endif
//*******************************************************************