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


C++ part函数代码示例

本文整理汇总了C++中part函数的典型用法代码示例。如果您正苦于以下问题:C++ part函数的具体用法?C++ part怎么用?C++ part使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: KURL

void QuickOpenFunctionDialog::gotoFile( QString name )
{
        FunctionModel *fmodel;
        FunctionList funcList;
        FunctionDom fdom;

        for( FunctionList::ConstIterator it = m_functionDefList.begin() ; it!=m_functionDefList.end() ; ++it ){
                fdom = *it;
                fmodel = fdom.data();
                if( fmodel->name() == name ){
                        funcList.append( fdom );
                }
        }
        if( funcList.count() == 1 ){
                fdom = funcList.first();
                fmodel = fdom.data();
                QString fileNameStr = fmodel->fileName();
                int startline, startcol;
                fmodel->getStartPosition( &startline, &startcol );
                m_part->partController()->editDocument( KURL( fileNameStr), startline, startcol );
                selectClassViewItem( ItemDom(&(*fmodel)) );

        }else if( funcList.count() > 1 ){
                QString fileStr;

                QuickOpenFunctionChooseForm fdlg( this, name.ascii() );

                for( FunctionList::Iterator it = funcList.begin() ; it!=funcList.end() ; ++it ){
                        fmodel = (*it).data();

                        fdlg.argBox->insertItem( m_part->languageSupport()->formatModelItem(fmodel) +
                                (fmodel->scope().isEmpty() ? "" : "   (in " + fmodel->scope().join("::") + ")"));
                        fileStr = KURL( fmodel->fileName() ).fileName();
                        KURL full_url( fmodel->fileName() );
                        KURL base_url( part()->project()->projectDirectory()+"/" );
                        fdlg.setRelativePath(fdlg.fileBox->count(),
                            KURL::relativeURL( base_url, full_url ));
                        fdlg.fileBox->insertItem(fileStr);
                }
                if( fdlg.exec() ){
                        int id = fdlg.argBox->currentItem();
                        if( id>-1 && id < (int) funcList.count() ){
                                FunctionModel *model = funcList[id].data();
                                int line, col;
                                model->getStartPosition( &line, &col );
                                selectClassViewItem( ItemDom(&(*model)) );
                                QString fileNameStr = model->fileName();
                                m_part->partController()->editDocument( KURL(fileNameStr), line );
                        }
                }
        }
        else{
                KMessageBox::error( this, i18n("Error: cannot find matching name function.") );
        }

        accept();
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:57,代码来源:quickopenfunctiondialog.cpp

示例2: cursorToByte

	void TextEditor::cursorMoveRight(uint offset)
	{
		uint index = cursorToByte(pCursorPos);
		AnyString part(pText, index);
		auto it = part.utf8begin();
		it += offset;
		byteToCursor(pCursorPos, index + it.offset());
		invalidate();
	}
开发者ID:libyuni,项目名称:libyuni,代码行数:9,代码来源:texteditor.cpp

示例3: part

void FilePath::discardMatchingHead(OovStringRef const pathPart)
    {
    std::string part(pathPart);
    if(pathStdStr().compare(0, part.length(), part) == 0)
        {
        CHECKSIZE(__FILE__, __LINE__, size(), part.length());
        pathStdStr().erase(0, part.length());
        }
    }
开发者ID:Purplenigma,项目名称:oovaide,代码行数:9,代码来源:FilePath.cpp

示例4: TEST

TEST(SimpleString, startsWith)
{
	SimpleString hi("Hi you!");
	SimpleString part("Hi");
	SimpleString diff("Hrrm Hi you! ffdsfd");
	CHECK(hi.startsWith(part));
	CHECK(!part.startsWith(hi));
	CHECK(!diff.startsWith(hi));
}
开发者ID:erizhang,项目名称:cpputest,代码行数:9,代码来源:SimpleStringTest.cpp

示例5: part

QImage DSPDFViewer::renderForTarget(QSharedPointer< Poppler::Page > page, QSize targetSize, bool onlyHalf, bool rightHalf)
{
  PagePart part( 
    onlyHalf?
      ( rightHalf? PagePart::RightHalf : PagePart::LeftHalf )
      : PagePart::FullPage );
  return RenderUtils::renderPagePart(page, targetSize, part);

}
开发者ID:wwwdata,项目名称:dspdfviewer,代码行数:9,代码来源:dspdfviewer.cpp

示例6: part

QPixmap QS60StylePrivate::backgroundTexture(bool /*skipCreation*/)
{
    if (!m_background) {
        const QSize size = QApplication::desktop()->screen()->size();
        QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size, 0);
        m_background = new QPixmap(background);
    }
    return *m_background;
}
开发者ID:Blizzard,项目名称:qt4,代码行数:9,代码来源:qs60style_simulated.cpp

示例7: addBodyPart

	bool TestLuaCharacter::testBodyParts()
	{
		lua::LuaState lua;

		int loadResult = lua.loadString(
			"char = am.character.new(\"charBodyPart\")\n"
			"function addBodyPart(part)\n"
			"	return char:add_body_part(part)\n"
			"end\n"
			"function removeBodyPart(part)\n"
			"	return char:remove_body_part(part)\n"
			"end\n"
			"function hasBodyPart(part)\n"
			"	return char:has_body_part(part)\n"
			"end\n"
			);
		
		if (!loadResult)
		{
			lua.logStack("LOAD ERR");
		}
		assert(loadResult);

		base::Handle<game::Character> charBodyPart = dynamic_cast<game::Character *>(game::Engine::getEngine()->getGameObject("charBodyPart"));

		assert(lua.hasGlobalFunction("hasBodyPart"));
		lua.push("arm");
		lua_acall(lua, 1, 1);
		assert(!lua_toboolean(lua, -1));
		lua.pop(1);

		assert(lua.hasGlobalFunction("addBodyPart"));
		base::Handle<BodyPart> part(new BodyPart("arm"));
		lua::wrapRefObject<game::BodyPart>(lua, part);
		lua_acall(lua, 1, 1);
		assert(lua_toboolean(lua, -1));
		lua.pop(1);

		assert(!charBodyPart->hasBodyPart(new BodyPart("arm")));
		assert(charBodyPart->hasBodyPart(part));
		assert(charBodyPart->hasBodyPart("arm"));

		assert(lua.hasGlobalFunction("hasBodyPart"));
		lua.push("arm");
		lua_acall(lua, 1, 1);
		assert(lua_toboolean(lua, -1));
		lua.pop(1);

		assert(lua.hasGlobalFunction("hasBodyPart"));
		lua::wrapRefObject<game::BodyPart>(lua, part);
		lua_acall(lua, 1, 1);
		assert(lua_toboolean(lua, -1));
		lua.pop(1);

		return true;
	}
开发者ID:astrellon,项目名称:Rouge,代码行数:56,代码来源:test_lua_character.cpp

示例8: while

status_t
ResourceFilter::parse(const char* arg)
{
    if (arg == NULL) {
        return 0;
    }

    const char* p = arg;
    const char* q;

    while (true) {
        q = strchr(p, ',');
        if (q == NULL) {
            q = p + strlen(p);
        }

        String8 part(p, q-p);

        if (part == "zz_ZZ") {
            mContainsPseudo = true;
        }
        int axis;
        uint32_t value;
        if (AaptGroupEntry::parseNamePart(part, &axis, &value)) {
            fprintf(stderr, "Invalid configuration: %s\n", arg);
            fprintf(stderr, "                       ");
            for (int i=0; i<p-arg; i++) {
                fprintf(stderr, " ");
            }
            for (int i=0; i<q-p; i++) {
                fprintf(stderr, "^");
            }
            fprintf(stderr, "\n");
            return 1;
        }

        ssize_t index = mData.indexOfKey(axis);
        if (index < 0) {
            mData.add(axis, SortedVector<uint32_t>());
        }
        SortedVector<uint32_t>& sv = mData.editValueFor(axis);
        sv.add(value);
        // if it's a locale with a region, also match an unmodified locale of the
        // same language
        if (axis == AXIS_LANGUAGE) {
            if (value & 0xffff0000) {
                sv.add(value & 0x0000ffff);
            }
        }
        p = q;
        if (!*p) break;
        p++;
    }

    return NO_ERROR;
}
开发者ID:4Fwolf,项目名称:mt6572_x201,代码行数:56,代码来源:ResourceFilter.cpp

示例9: cs_cmd_drop

static void cs_cmd_drop(char *origin)
{
	user_t *u = user_find_named(origin);
	mychan_t *mc;
	char *name = strtok(NULL, " ");

	if (!name)
	{
		notice(chansvs.nick, origin, STR_INSUFFICIENT_PARAMS, "DROP");
		notice(chansvs.nick, origin, "Syntax: DROP <#channel>");
		return;
	}

	if (*name != '#')
	{
		notice(chansvs.nick, origin, STR_INVALID_PARAMS, "DROP");
		notice(chansvs.nick, origin, "Syntax: DROP <#channel>");
		return;
	}

	if (!(mc = mychan_find(name)))
	{
		notice(chansvs.nick, origin, "\2%s\2 is not registered.", name);
		return;
	}

	if (!is_founder(mc, u->myuser) && !has_priv(u, PRIV_CHAN_ADMIN))
	{
		notice(chansvs.nick, origin, "You are not authorized to perform this operation.");
		return;
	}

	if (metadata_find(mc, METADATA_CHANNEL, "private:close:closer") && !has_priv(u, PRIV_CHAN_ADMIN))
	{
		logcommand(chansvs.me, u, CMDLOG_REGISTER, "%s failed DROP (closed)", mc->name);
		notice(chansvs.nick, origin, "The channel \2%s\2 is closed; it cannot be dropped.", mc->name);
		return;
	}

	if (!is_founder(mc, u->myuser))
	{
		logcommand(chansvs.me, u, CMDLOG_ADMIN, "%s DROP", mc->name);
		wallops("%s dropped the channel \2%s\2", origin, name);
	}
	else
		logcommand(chansvs.me, u, CMDLOG_REGISTER, "%s DROP", mc->name);

	snoop("DROP: \2%s\2 by \2%s\2 as \2%s\2", mc->name, u->nick, u->myuser->name);

	hook_call_event("channel_drop", mc);
	if ((config_options.chan && irccasecmp(mc->name, config_options.chan)) || !config_options.chan)
		part(mc->name, chansvs.nick);
	mychan_delete(mc->name);
	notice(chansvs.nick, origin, "The channel \2%s\2 has been dropped.", name);
	return;
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:56,代码来源:drop.c

示例10: vecUnit

void Game::splashBlood(Enemy &enemy, sf::Vector2f vel, int amount) {
	for (int i=-amount/2; i<amount/2; i++) {
		sf::Vector2f pvel = vecUnit(vecUnit(vel) + vecUnit(sf::Vector2f(vel.y, -vel.x))*float(i/50.0)) *
			(0.0004f + (rand() % 10) / 50000.f);
		Particle part(&clock, &window, rand() % 2 + 1, pvel, -0.0000000005, sf::Color::Red);
		part.disappear = false;
		part.position = enemy.position;
		particles.push_back(part);
	}
}
开发者ID:hotline-mp,项目名称:shooter,代码行数:10,代码来源:Game.cpp

示例11: quick

int quick(int a[],int low,int high)
{
  int pivot;
  if(high>low)
  {
      pivot=part(a,low,high);
      quick(a,low,pivot-1);
      quick(a,pivot+1,high);
  }
}
开发者ID:mkhanw01,项目名称:DataStructure,代码行数:10,代码来源:sum_is_k.c

示例12: sort

void sort(int l, int r, int A[]) {
    if (r <= l) {
        return;
    }
    calls++;
    int pi = findPivotIndex(l, r, A);
    pi = part(l, r, pi, A);
    sort(l, pi - 1, A);
    sort(pi+1, r, A);
}
开发者ID:ismo1652,项目名称:jvmnotebook,代码行数:10,代码来源:Sorter.c

示例13: dupw

char* TLV::dupw(void) 
{ 
    wchar_t *str = (wchar_t*)part(0, length_);
    wcs_htons(str);

    char* stru = mir_utf8encodeW(str);
    mir_free(str);

    return stru; 
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:10,代码来源:tlv.cpp

示例14: main

int main() {
	dn = 0; dfs(1);
	for (i=2; i<=n; i++)
		if (dfn[ par[i]->op->j ] < low[i])
			par[i]->b = par[i]->op->b = true;
	memset(bel,0,sizeof(bel));
	for (i=1; i<=n; i++)
		if (!bel[i]) rt[++cnt] = i,part(i);
	return 0;
}
开发者ID:lchc,项目名称:.backup,代码行数:10,代码来源:Tarjan[1].cpp

示例15: part

//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
float RigFemPartCollection::characteristicElementSize()
{
    if (partCount())
    {
        return part(0)->characteristicElementSize();
    }
    else
    {
        return 0;
    }
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:14,代码来源:RigFemPartCollection.cpp


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