本文整理汇总了C++中SquirrelObject::ArrayAppend方法的典型用法代码示例。如果您正苦于以下问题:C++ SquirrelObject::ArrayAppend方法的具体用法?C++ SquirrelObject::ArrayAppend怎么用?C++ SquirrelObject::ArrayAppend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SquirrelObject
的用法示例。
在下文中一共展示了SquirrelObject::ArrayAppend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Draw
void UIManager::Draw(HWND hWnd, HDC hdc)
{
EnterCriticalSection(&m_DrawCrit);
int before, after;
unsigned int i, cnt = 0;
std::vector<LyricLine> lyric = LyricManagerInstance->GetLyric();
after = before = m_Setting->GetnLine() / 2 - lyric.size() / 2;
if(after < 0)
after = 0;
if(before < 0)
before = 0;
std::vector<LyricLine> lyricbefore = LyricManagerInstance->GetLyricBefore(before);
std::vector<LyricLine> lyricafter = LyricManagerInstance->GetLyricAfter(after + lyric.size() - 1 - (1 - m_Setting->GetnLine() % 2));
//현재 가사가 1줄 이상인 경우에는 두번째 줄부터
if(!lyric.size())
return;
SquirrelVM::SetVMSys(m_vmSys);
SquirrelObject lyrics = SquirrelVM::CreateArray(0);
for(i = 0; i < before - lyricbefore.size(); i ++)
lyrics.ArrayAppend((std::wstring(1, (wchar_t)2) + TEXT(" ")).c_str());
if(lyric.size() < m_Setting->GetnLine())
{
for(i = 0; i < lyricbefore.size(); i ++)
{
std::wstring nowlrcw = std::wstring(1, (wchar_t)2) + pfc::stringcvt::string_wide_from_utf8_fast(lyricbefore[i].lyric.c_str()).get_ptr();
lyrics.ArrayAppend(nowlrcw.c_str());
}
}
for(i = 0; i < lyric.size(); i ++)
{
std::wstring nowlrcw = std::wstring(1, (wchar_t)1) + pfc::stringcvt::string_wide_from_utf8_fast(lyric[i].lyric.c_str()).get_ptr();
lyrics.ArrayAppend(nowlrcw.c_str());
}
for(i = max(lyric.size() - 1, 0); i < lyricafter.size(); i ++)
{
std::wstring nowlrcw = std::wstring(1, (wchar_t)2) + pfc::stringcvt::string_wide_from_utf8_fast(lyricafter[i].lyric.c_str()).get_ptr();
lyrics.ArrayAppend(nowlrcw.c_str());
}
UICanvas canvas(hWnd, hdc);
SqPlus::SquirrelFunction<void>(m_RootTable, TEXT("Draw"))(&canvas, lyrics);
LeaveCriticalSection(&m_DrawCrit);
}