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


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

本文整理汇总了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();
	}
}
开发者ID:akostrikov,项目名称:image-uploader,代码行数:27,代码来源:RegularExpression.cpp

示例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);
}
开发者ID:dlunch,项目名称:foo_alsong_lyric,代码行数:46,代码来源:UIManager.cpp


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