📄 qconfig.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/Intrface/QConfig.h,v $
* $Date: 2003/05/13 18:42:07 $
*
Description:
\*____________________________________________________________________________*/
/* $SourceTop:$ */
#ifndef QCONFIG_H_
#define QCONFIG_H_
#include <iostream.h>
#include "Pi2API.h"
#include "PIString.h"
#include "DblList.h"
#define QCONFIG_KEY "QConfig"
#define DEFAULT_HANDLERS "\tHandlers Start Scripts WinScripts FastCGIScripts ISAPI Options Default"
/*
** Constants
*/
#define M_CB_ADD (1)
#define M_CB_DELETE (2)
#define M_CB_BEFORESECTIONWRITE (3)
#define M_CB_AFTERSECTIONWRITE (4)
/*____________________________________________________________________________*\
*
Description: Structure for SECTIONWRITE callbacks
\*____________________________________________________________________________*/
class SectionWriteCallBackStructure
{
public:
ostream &os; /* the output stream being written to */
SectionWriteCallBackStructure( ostream &tTheOs )
: os( tTheOs )
{
};
};
/*____________________________________________________________________________*\
*
Description:
\*____________________________________________________________________________*/
class QConfig
{
private:
typedef void TConfig;
TConfig *pConfig;
PIString sRetained;
DblList lSections;
int Internal_changeValue( const char *pSection, const char *pVariable,
const char *pNewValue, int iReplace );
int Internal_destroyTConfig();
public:
QConfig();
~QConfig();
const char *LookupValue( const char *pSection, const char *pVariable );
const char *LookupValueEx( const char *pSection, const char *pVariable,
int iIndex );
int AddValue( const char *pSection, const char *pVariable,
const char *pNewValue );
int ReplaceValue( const char *pSection, const char *pVariable,
const char *pNewValue );
int DeleteValue( const char *pSection, const char *pVariable );
const char *LookupSection( int iIndex );
int LookupPair( const char *pSection,
int iIndex, const char **ppVariable, const char **ppValue );
void RegisterCallBack( const char *pSection,
int (* fnCallBack)( const char *pSection,
const char *pVariable, int iAction, void *pActionData,
void *pData ), void *pCallBackData );
int DispatchWriteCallBacks( const char *pSection,
int iAction, ostream &os );
PIString &GetRetained() { return sRetained; };
void SetRetained( const char *pRetained ) { sRetained = pRetained; };
};
/*
** Function prototypes
*/
QConfig *CreateQConfig();
void DestroyQConfig( QConfig *pConfig );
QConfig *FindParentQConfig( PIDB *pCurrentDB );
/*
** Some quick macros for QConfig
*/
#define M_ReplaceValue(pconfig,section,variable,newvalue) \
((pconfig)->ReplaceValue( section, variable, newvalue ))
#define M_LookupValue(pconfig,section,variable) \
((pconfig)->LookupValue( section, variable ))
#define M_LookupValueEx(pconfig,section,variable,index) \
((pconfig)->LookupValueEx( section, variable, index ))
#define M_AddValue(pconfig,section,variable,value) \
((pconfig)->AddValue( section, variable, value ))
#define M_DeleteValue(pconfig,section,variable) \
((pconfig)->DeleteValue( section, variable ))
#define M_LookupSection(pconfig,index) \
((pconfig)->LookupSection(index))
#define M_LookupPair(pconfig,section,index,ppvariable,ppvalue) \
((pconfig)->LookupPair(section,index,ppvariable,ppvalue))
#define M_RegisterCallBack(pconfig,section,callback,data) \
((pconfig)->RegisterCallBack(section,callback,data))
#define M_DispatchWriteCallBacks(pconfig,section,action,stream) \
((pconfig)->DispatchWriteCallBacks(section,action,stream))
#endif /* QCONFIG_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -