当前位置: 首页>>代码示例>>C++>>正文


C++ Any::getInt方法代码示例

本文整理汇总了C++中Any::getInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Any::getInt方法的具体用法?C++ Any::getInt怎么用?C++ Any::getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Any的用法示例。


在下文中一共展示了Any::getInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: shr

int32_t Any::shr (const Any &l, const Any &r) {
	if (l.type() == Any::Int && r.type() == Any::Int) {
		int32_t a = l.getInt();
		int32_t b = r.getInt();
		uint32_t ret = *reinterpret_cast<uint32_t*>( &a ) >> *reinterpret_cast<uint32_t*>( &b );
		return *reinterpret_cast<int32_t*>( &ret );
	}
开发者ID:fennekki,项目名称:cbEnchanted,代码行数:7,代码来源:any.cpp

示例2:

Any Any::operator + (const Any &r) const {
	switch (this->type()) {
		case Any::Int:
			switch (r.type()) {
				case Any::Int: return this->getInt() + r.getInt();
				case Any::Float: return this->getInt() + r.getFloat();
				case Any::String: return boost::lexical_cast<string>(this->getInt()) + r.getString();
			}
			break;
		case Any::Float:
			switch (r.type()) {
				case Any::Int: return this->getFloat() + r.getInt();
				case Any::Float: return this->getFloat() + r.getFloat();
				case Any::String: return boost::lexical_cast<string>(this->getFloat()) + r.getString();
			}
			break;
		case Any::String:
			switch (r.type()) {
				case Any::Int: return this->getString() + boost::lexical_cast<string>(r.getInt());
				case Any::Float: return this->getString() + boost::lexical_cast<string>(r.getFloat());
				case Any::String: return this->getString() + r.getString();
			}
			break;
	}
	FIXME("Unsupported operation %s + %s", this->typeInfo().name(), r.typeInfo().name());
	return 0;
}
开发者ID:fennekki,项目名称:cbEnchanted,代码行数:27,代码来源:any.cpp

示例3: functionAbs

void MathInterface::functionAbs(void) {
	Any v = cb->popValue();
	if (v.type() == Any::Float) {
		cb->pushValue(abs(v.getFloat()));
		return;
	}
	cb->pushValue(abs(v.getInt()));
	return;
}
开发者ID:fennekki,项目名称:cbEnchanted,代码行数:9,代码来源:mathinterface.cpp

示例4: functionWrapAngle

void MathInterface::functionWrapAngle(void) {
	Any a = cb->popValue();
	if (a.type() == Any::Float) {
		cb->pushValue(wrapAngle(a.getFloat()));
	}
	else { // Has to be int
		cb->pushValue(wrapAngle(a.getInt()));
	}
}
开发者ID:fennekki,项目名称:cbEnchanted,代码行数:9,代码来源:mathinterface.cpp

示例5: return

Any Any::operator % (const Any &r) const {
	switch (this->type()) {
		case Any::Int:
			switch (r.type()) {
				case Any::Int: return this->getInt() % r.getInt();
				case Any::Float: return (float)fmod((double)this->getInt(), (double)r.getFloat());
			}
			break;
		case Any::Float:
			switch (r.type()) {
				case Any::Int: return (float)fmod((double)this->getFloat(), (double)r.getInt());
				case Any::Float: return (float)fmod(this->getFloat(), r.getFloat());
			}
			break;
	}
	FIXME("Unsupported operation %s % %s", this->typeInfo().name(), r.typeInfo().name());
	return 0;
}
开发者ID:fennekki,项目名称:cbEnchanted,代码行数:18,代码来源:any.cpp

示例6: functionStr

void StringInterface::functionStr(void) {
	Any a = cb->popValue();
	switch (a.type()) {
		case Any::Int:
			cb->pushValue(lexical_cast<string>(a.getInt()));
		return;
		case Any::Float:
			cb->pushValue(lexical_cast<string>(a.getFloat()));
		return;
		default:
			cb->pushValue(a);
	}
}
开发者ID:misthema,项目名称:cbEnchanted,代码行数:13,代码来源:stringinterface.cpp


注:本文中的Any::getInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。