⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callback.cpp

📁 The goal of this library is to make ODBC recordsets look just like an STL container. As a user, you
💻 CPP
字号:
#include "callback.h"

BEGIN_DTL_NAMESPACE
#if 0
//putting this here actually prevented some optimizations, so still inline

CBFunctorBase::CBFunctorBase(const void *c,_Func f, const void *mf,size_t sz)
	{
	if(c)	//must be callee/memfunc
		{
		callee = (void *)c;
		memcpy(memFunc,mf,sz);
		if(sz<MEM_FUNC_SIZE)	//zero-out the rest if any, so comparisons work
			{
			memset(memFunc+sz,0,MEM_FUNC_SIZE-sz);
			}
		}
	else	//must be ptr-to-func
		{
		func = f;
		}
	}
#endif

RHCB_BOOL operator==(const CBFunctorBase &lhs,const CBFunctorBase &rhs)
	{
	if(!lhs.callee)
		{
		if(rhs.callee)
			return RHCB_FALSE;
		return lhs.func == rhs.func;
		}
	else
		{
		if(!rhs.callee)
			return RHCB_FALSE;
		return lhs.callee == rhs.callee &&
			!memcmp(lhs.memFunc,rhs.memFunc,CBFunctorBase::MEM_FUNC_SIZE);
		}
	}

RHCB_BOOL operator!=(const CBFunctorBase &lhs,const CBFunctorBase &rhs)
	{
	return !operator==(lhs,rhs);
	}

RHCB_BOOL operator<(const CBFunctorBase &lhs,const CBFunctorBase &rhs)
	{
	//must order across funcs and callee/memfuncs, funcs are first
	if(!lhs.callee)
		{
		if(rhs.callee)
			return RHCB_TRUE;
		else
			return lhs.func < rhs.func;
		}
	else
		{
		if(!rhs.callee)
			return RHCB_FALSE;
		if(lhs.callee != rhs.callee)
			return lhs.callee < rhs.callee;
		else
			return memcmp(lhs.memFunc,rhs.memFunc,CBFunctorBase::MEM_FUNC_SIZE)<0;
		}
	}

END_DTL_NAMESPACE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -