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


C++ SquirrelObject::SetValue方法代码示例

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


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

示例1: findAll

SquirrelObject RegularExpression::findAll(const std::string& str)
{
	try {
		size_t pos = 0;
		SquirrelObject res = SquirrelVM::CreateArray(0);
		while (pos <= str.length()) 
		{
			if ( pcre_->search(str, pos)) 
			{ 
				pos = pcre_->get_match_end()+1;
				int count = matchesCount();
				SquirrelObject mat = SquirrelVM::CreateArray(count);
				for ( int i = 0; i < count; i++ ) {
					mat.SetValue(i, pcre_->get_match(i).c_str());
				}
				res.ArrayAppend(mat);
			}
			else {
				break;
			}
		}
		return res;
	} catch( Pcre::exception ex ) {
		LOG(ERROR) << ex.what();
		return SquirrelObject();
	}
}
开发者ID:akostrikov,项目名称:image-uploader,代码行数:27,代码来源:RegularExpression.cpp

示例2: GetAppVersion

SquirrelObject GetAppVersion() {
	SquirrelObject res = SquirrelVM::CreateTable();
	std::string ver = _APP_VER;
	std::vector<std::string> tokens;
	IuStringUtils::Split(ver,".", tokens, 3);
	if ( tokens.size() >=3 ) {
		res.SetValue("Major", (SQInteger)IuCoreUtils::stringToint64_t(tokens[0]));
		res.SetValue("Minor", (SQInteger)IuCoreUtils::stringToint64_t(tokens[1]));
		res.SetValue("Release", (SQInteger)IuCoreUtils::stringToint64_t(tokens[2]));
		res.SetValue("Build", (SQInteger)IuCoreUtils::stringToint64_t(BUILD));
		bool isGui = 
#ifndef IU_CLI
			true;
#else 
			false;
#endif
		res.SetValue("Gui",isGui);
	}
	return res;
}
开发者ID:akostrikov,项目名称:image-uploader,代码行数:20,代码来源:Functions.cpp

示例3: split

/*
RegularExpression::RegularExpression(const RegularExpression& r)
{
	
}
*/
SquirrelObject RegularExpression::split(const std::string& piece)
{
	try {
		std::vector<std::string> res = pcre_->split(piece);
		SquirrelObject obj = SquirrelVM::CreateArray(res.size());
		for( int i = 0; i  < res.size(); i++ ) {
			obj.SetValue(i, res[i].c_str());
		}
		return obj;
	} catch( Pcre::exception ex ) {
		LOG(ERROR) << ex.what();
		return SquirrelObject();
	}
}
开发者ID:akostrikov,项目名称:image-uploader,代码行数:20,代码来源:RegularExpression.cpp

示例4: getSubStrings

SquirrelObject RegularExpression::getSubStrings()
{
	try {
		std::vector<std::string>* substrings =  pcre_->get_sub_strings();
		if ( !substrings ) {
			return SquirrelObject();
		}
		SquirrelObject res = SquirrelVM::CreateArray(substrings->size());
		for ( int i = 0; i < substrings->size(); i++ ) {
			res.SetValue(i, (*substrings)[i].c_str());
		}
		return res;
	} catch( Pcre::exception ex ) {
		LOG(ERROR) << ex.what();
		return SquirrelObject();
	}
}
开发者ID:akostrikov,项目名称:image-uploader,代码行数:17,代码来源:RegularExpression.cpp


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