Import initial din SVN ROAAUTO/Trunk @HEAD
This commit is contained in:
177
COMUN/utile/web/wwresponsestring.prg
Normal file
177
COMUN/utile/web/wwresponsestring.prg
Normal file
@@ -0,0 +1,177 @@
|
||||
**
|
||||
** wwresponsestring.fxp
|
||||
**
|
||||
SET PROCEDURE TO wwResponse ADDITIVE
|
||||
ENDPROC
|
||||
*
|
||||
DEFINE CLASS wwResponseString AS wwResponse
|
||||
coUtput = ""
|
||||
PROTECTED cfIlename
|
||||
cfIlename = ""
|
||||
PROTECTED ldUmptofile
|
||||
ldUmptofile = .F.
|
||||
PROTECTED chTmlfilename
|
||||
chTmlfilename = ""
|
||||
PROTECTED ohTmlfile
|
||||
ohTmlfile = .NULL.
|
||||
nbUffersize = 10000
|
||||
*
|
||||
FUNCTION getoutput
|
||||
LPARAMETER llNoclear
|
||||
LOCAL lcFile, lcOutput
|
||||
IF thIs.ldUmptofile
|
||||
thIs.ohTmlfile.deStroy()
|
||||
thIs.ohTmlfile = .NULL.
|
||||
thIs.ldUmptofile = .F.
|
||||
lcOutput = fiLe2var(thIs.chTmlfilename)
|
||||
ERASE (thIs.chTmlfilename)
|
||||
IF llNoclear
|
||||
thIs.coUtput = lcOutput
|
||||
ELSE
|
||||
thIs.coUtput = ""
|
||||
ENDIF
|
||||
RETURN lcOutput
|
||||
ENDIF
|
||||
IF llNoclear
|
||||
RETURN thIs.coUtput
|
||||
ENDIF
|
||||
lcOutput = thIs.coUtput
|
||||
thIs.coUtput = ""
|
||||
RETURN lcOutput
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION getoutputnoclear
|
||||
RETURN thIs.geToutput(.T.)
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION WRITE
|
||||
LPARAMETER tcText, tlNooutput
|
||||
IF tlNooutput .OR. thIs.lnOoutput
|
||||
RETURN tcText
|
||||
ENDIF
|
||||
IF thIs.ldUmptofile
|
||||
thIs.ohTmlfile.faStwrite(@tcText)
|
||||
ELSE
|
||||
IF LEN(thIs.coUtput)<thIs.nbUffersize
|
||||
thIs.coUtput = thIs.coUtput+tcText
|
||||
ELSE
|
||||
thIs.ldUmptofile = .T.
|
||||
thIs.ohTmlfile = CREATEOBJECT('wwResponseFile', SYS(2023)+ ;
|
||||
"\"+SYS(2015)+TRIM(TRANSFORM(RAND()*1000, ;
|
||||
'999'))+".tmp")
|
||||
thIs.chTmlfilename = thIs.ohTmlfile.cfIlename
|
||||
thIs.ohTmlfile.faStwrite(thIs.coUtput+tcText)
|
||||
ENDIF
|
||||
ENDIF
|
||||
RETURN ""
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION SEND
|
||||
LPARAMETER tcText, tlNooutput
|
||||
RETURN thIs.wrIte(@tcText,tlNooutput)
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION FastWrite
|
||||
LPARAMETER tcText, tlNooutput
|
||||
IF thIs.ldUmptofile
|
||||
thIs.ohTmlfile.faStwrite(@tcText)
|
||||
ELSE
|
||||
IF LEN(thIs.coUtput)<thIs.nbUffersize
|
||||
thIs.coUtput = thIs.coUtput+tcText
|
||||
ELSE
|
||||
thIs.wrIte(@tcText)
|
||||
ENDIF
|
||||
ENDIF
|
||||
RETURN ""
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION FastSend
|
||||
LPARAMETER tcText, tlNooutput
|
||||
RETURN thIs.faStwrite(@tcText,tlNooutput)
|
||||
ENDFUNC
|
||||
*
|
||||
PROCEDURE CLEAR
|
||||
IF thIs.ldUmptofile
|
||||
thIs.ohTmlfile.deStroy()
|
||||
thIs.ohTmlfile = .NULL.
|
||||
IF .NOT. EMPTY(thIs.chTmlfilename)
|
||||
ERASE (thIs.chTmlfilename)
|
||||
ENDIF
|
||||
ENDIF
|
||||
thIs.ldUmptofile = .F.
|
||||
thIs.ohTmlfile = .NULL.
|
||||
thIs.coUtput = ""
|
||||
ENDPROC
|
||||
*
|
||||
PROCEDURE Rewind
|
||||
thIs.clEar()
|
||||
ENDPROC
|
||||
*
|
||||
PROCEDURE DESTROY
|
||||
IF thIs.ldUmptofile
|
||||
IF .NOT. ISNULL(thIs.ohTmlfile)
|
||||
thIs.ohTmlfile.deStroy()
|
||||
ENDIF
|
||||
ERASE (thIs.chTmlfilename)
|
||||
ENDIF
|
||||
ENDPROC
|
||||
*
|
||||
PROCEDURE INIT
|
||||
LPARAMETER lcReserved
|
||||
ENDPROC
|
||||
*
|
||||
ENDDEFINE
|
||||
*
|
||||
DEFINE CLASS wwResponseStringNoBuffer AS wwResponse
|
||||
coUtput = ""
|
||||
*
|
||||
FUNCTION getoutput
|
||||
LPARAMETER llNoclear
|
||||
LOCAL lcFile, lcOutput
|
||||
IF llNoclear
|
||||
RETURN thIs.coUtput
|
||||
ENDIF
|
||||
lcOutput = thIs.coUtput
|
||||
thIs.coUtput = ""
|
||||
RETURN lcOutput
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION getoutputnoclear
|
||||
LOCAL lcFile
|
||||
RETURN thIs.coUtput
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION WRITE
|
||||
LPARAMETER tcText, tlNooutput
|
||||
IF tlNooutput .OR. thIs.lnOoutput
|
||||
RETURN tcText
|
||||
ENDIF
|
||||
thIs.coUtput = thIs.coUtput+tcText
|
||||
RETURN ""
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION SEND
|
||||
LPARAMETER tcText, tlNooutput
|
||||
RETURN thIs.wrIte(@tcText,tlNooutput)
|
||||
ENDFUNC
|
||||
*
|
||||
FUNCTION FastWrite
|
||||
LPARAMETER tcText, tlNooutput
|
||||
thIs.coUtput = thIs.coUtput+tcText
|
||||
RETURN ""
|
||||
ENDFUNC
|
||||
*
|
||||
PROCEDURE Rewind
|
||||
thIs.clEar()
|
||||
ENDPROC
|
||||
*
|
||||
PROCEDURE CLEAR
|
||||
thIs.coUtput = ""
|
||||
ENDPROC
|
||||
*
|
||||
PROCEDURE INIT
|
||||
LPARAMETER lcReserved
|
||||
ENDPROC
|
||||
*
|
||||
ENDDEFINE
|
||||
*
|
||||
Reference in New Issue
Block a user