📄 handbase.h
字号:
/*____________________________________________________________________________*\
*
Copyright (c) 1997-2003 John Roy, Holger Zimmermann. All rights reserved.
These sources, libraries and applications are
FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
as long as the following conditions are adhered to.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*____________________________________________________________________________*|
*
* $Source: /cvsroot/pi3web/Pi3Web_200/Source/HTTP/HandBase.h,v $
* $Date: 2003/05/13 18:42:03 $
*
Description:
\*____________________________________________________________________________*/
//$SourceTop:$
#ifndef HANDBASE_H_
#define HANDBASE_H_
#include <assert.h>
#include "Pi2API.h"
#include "PIString.h"
#include "PIHTTP.h"
/*____________________________________________________________________________*\
*
Function:
Synopsis:
Description:
\*____________________________________________________________________________*/
#define CONFIG_ERR(this, msg) \
{ PILog_addMessage( PIObject_getDB(this), \
PIObject_getConfigurationDB(this), PILOG_ERROR, "%s", (msg) ); }
/*
#define D { cerr << __FILE__ << ", " << __LINE__ << ": " << endl; }
*/
#define D
/*____________________________________________________________________________*\
*
Class:
Description:
\*____________________________________________________________________________*/
class HandlerBaseHTTP
{
private:
/* ---
Configuration data
--- */
PIObject *pObject; /* the object */
int iOK; /* status */
protected:
/* --- dummy copy constructor --- */
HandlerBaseHTTP( const HandlerBaseHTTP & )
{ assert( 0 ); };
/* ---
Derived classes override this to handle parameters
--- */
virtual int Parameter( const char *pVariable, const char *pValue,
const char *pWhere )=0;
inline void SetOK( int iNewValue ) { iOK = iNewValue; };
static int ParameterFn( void *pData, const char *pVar, const char *pVal,
const char *pWhere )
{
assert( pData );
return ((HandlerBaseHTTP *)pData)->Parameter( pVar, pVal,
pWhere ? pWhere : "" );
};
public:
HandlerBaseHTTP( PIObject *pTheObject );
virtual ~HandlerBaseHTTP();
virtual int Handle( int iPhase, PIHTTP &tPIHTTP, PIIOBuffer &tBuffer )=0;
virtual int Execute( int iArgc, const char *ppArgv[] );
inline int IsOK() { return iOK; };
inline PIObject *Object() { return pObject; };
void ReadParameters( int iArgc, const char *ppArgv[] );
};
/*____________________________________________________________________________*\
*
Function:
Synopsis:
Description:
Function prototypes
\*____________________________________________________________________________*/
PUBLIC_PIAPI int HandlerBaseHTTP_execute( PIObject *pObj, int iArgc,
const char *ppArgv[] );
PUBLIC_PIAPI int HandlerBaseHTTP_onClassLoad( PIClass_LoadAction eLoad, void * );
PUBLIC_PIAPI int HandlerBaseHTTP_constructor( PIObject *pObj,
HandlerBaseHTTP *pHandler );
PUBLIC_PIAPI int HandlerBaseHTTP_copyConstructor( PIObject *, int,
const char *[]);
PUBLIC_PIAPI int HandlerBaseHTTP_destructor( PIObject *pObj, int,
const char *[] );
#endif /* HANDBASE_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -