本文整理汇总了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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}