本文整理汇总了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();
}
示例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();
}
示例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());
}
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例15: part
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
float RigFemPartCollection::characteristicElementSize()
{
if (partCount())
{
return part(0)->characteristicElementSize();
}
else
{
return 0;
}
}