本文整理汇总了C++中part函数的典型用法代码示例。如果您正苦于以下问题:C++ part函数的具体用法?C++ part怎么用?C++ part使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了part函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: part
u16 CPartition::part_id(const shared_str& name) const
{
for(u16 i=0; i<MAX_PARTS; ++i)
{
const CPartDef& pd = part(i);
if(pd.Name == name)
return i;
}
Msg("! there is no part named [%s]", name.c_str() );
return u16(-1);
}
开发者ID:2asoft,项目名称:xray,代码行数:11,代码来源:SkeletonMotions.cpp
示例17: qs
void qs(int a[],int p,int q)
{
if(p<q)
{
part(a,p,q);
int b=s,c=t;
qs(a,p,b-1);
qs(a,b+1,c-1);
qs(a,c+1,q);
}
}
开发者ID:kshav,项目名称:My_codes,代码行数:11,代码来源:quick+sort+2+variables.c
示例18: TaskWPGanttView
TaskWPGanttView *View::createGanttView()
{
TaskWPGanttView *v = new TaskWPGanttView( part(), this );
connect( v, SIGNAL(requestPopupMenu(QString,QPoint)), this, SLOT(slotPopupMenu(QString,QPoint)) );
connect( v, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) );
v->updateReadWrite( m_readWrite );
v->loadContext();
return v;
}
开发者ID:KDE,项目名称:calligra,代码行数:11,代码来源:view.cpp
示例19: quick
int quick(int *arr,int l,int n)
{ int j;
if(l<=(n))
{
j=part(arr,l,n);
quick(arr,l,j-1);
quick(arr,j+1,n);
}
return 0;
}
开发者ID:giteshgoyal,项目名称:dynamiclibraryC,代码行数:11,代码来源:quicksort.c
示例20: selecte
int selecte(int *a, int p, int r, int i) {
if(p == r)
return *(a+p);
int q = part(a, p, r); //r_partition(a, p, r);
int k = q - p + 1;
printf("\n%d %d", i, k);
if(i <= k)
return selecte(a, p, q, i);
else
return selecte(a, q+1, r, i-k);
}
开发者ID:Rohit--Sharma,项目名称:rohit123,代码行数:11,代码来源:8_kthLargest_MedianOfMedians_2.c
注:本文中的part函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论