本文整理汇总了C++中IndexOf函数的典型用法代码示例。如果您正苦于以下问题:C++ IndexOf函数的具体用法?C++ IndexOf怎么用?C++ IndexOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IndexOf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: IndexOf
void
EditListView::MouseDown(BPoint where)
{
BListView::MouseDown(where);
int32 index = IndexOf(where);
EditableListItem* handler = dynamic_cast<EditableListItem*>(ItemAt(index));
if (handler == NULL)
return;
fLastMouseDown = handler;
handler->MouseDown(where);
SetMouseEventMask(B_POINTER_EVENTS);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:14,代码来源:IMAPFolderConfig.cpp
示例2: IndexOf
/**
@return 0 or a positive integer if a plugin was released and deleted, otherwise KErrNotFound
@internalComponent
@released
*/
TInt CSusUtilServer::UnLoadUtilityPluginL(TSsmSupInfo& aSupInfo)
{
RLibrary lib;
SusPluginLoader::LoadDllFileLC(lib, aSupInfo); // open handle on CleanupStack
const TInt index = IndexOf(lib, aSupInfo.NewLOrdinal());
if( index > KErrNotFound )
{
CSusPluginFrame* frame = iLoadedPlugins[index];
iLoadedPlugins.Remove(index);
delete frame;
}
CleanupStack::PopAndDestroy(&lib);
return index;
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:19,代码来源:susutilserver.cpp
示例3: _MANAGER
void Manager::ExecuteNonModal()
{
_MANAGER(CleverSysLog clv(L"Manager::ExecuteNonModal ()"));
_MANAGER(SysLog(L"ExecutedFrame=%p, InsertedFrame=%p, DeletedFrame=%p",ExecutedFrame, InsertedFrame, DeletedFrame));
Frame *NonModal=InsertedFrame?InsertedFrame:(ExecutedFrame?ExecutedFrame:ActivatedFrame);
if (!NonModal)
{
return;
}
/* $ 14.05.2002 SKV
Положим текущий фрэйм в список "родителей" полумодальных фрэймов
*/
//Frame *SaveFrame=CurrentFrame;
//AddSemiModalBackFrame(SaveFrame);
int NonModalIndex=IndexOf(NonModal);
if (-1==NonModalIndex)
{
InsertedFrame=NonModal;
ExecutedFrame=nullptr;
InsertCommit();
InsertedFrame=nullptr;
}
else
{
ActivateFrame(NonModalIndex);
}
//Frame* ModalStartLevel=NonModal;
for (;;)
{
Commit();
if (CurrentFrame!=NonModal || EndLoop)
{
break;
}
ProcessMainLoop();
}
//ExecuteModal(NonModal);
/* $ 14.05.2002 SKV
... и уберём его же.
*/
//RemoveSemiModalBackFrame(SaveFrame);
}
开发者ID:CyberShadow,项目名称:FAR,代码行数:49,代码来源:manager.cpp
示例4: switch
/*****************************************************************************
* DragSortableListView::MouseMoved
*****************************************************************************/
void
DragSortableListView::MouseMoved(BPoint where, uint32 transit, const BMessage *msg)
{
if ( msg && ( msg->what == B_SIMPLE_DATA || msg->what == MSG_SOUNDPLAY ) )
{
bool replaceAll = !msg->HasPointer("list") && !(modifiers() & B_SHIFT_KEY);
switch ( transit )
{
case B_ENTERED_VIEW:
// remember drag message
// this is needed to react on modifier changes
fDragMessageCopy = *msg;
case B_INSIDE_VIEW:
{
if ( replaceAll )
{
BRect r( Bounds() );
r.bottom--; // compensate for scrollbar offset
_SetDropAnticipationRect( r );
fDropIndex = -1;
}
else
{
// offset where by half of item height
BRect r( ItemFrame( 0 ) );
where.y += r.Height() / 2.0;
int32 index = IndexOf( where );
if ( index < 0 )
index = CountItems();
_SetDropIndex( index );
}
break;
}
case B_EXITED_VIEW:
// forget drag message
fDragMessageCopy.what = 0;
case B_OUTSIDE_VIEW:
_RemoveDropAnticipationRect();
break;
}
}
else
{
_RemoveDropAnticipationRect();
BListView::MouseMoved(where, transit, msg);
fDragMessageCopy.what = 0;
}
}
开发者ID:forthyen,项目名称:SDesk,代码行数:52,代码来源:ListViews.cpp
示例5: while
/*
* Finds the following sibling of aNode and returns it. If a sibling
* is found, mCurrentNode is set to that node.
* @param aNode Node to start search at.
* @param aReversed Reverses search to find the previous sibling
* instead of next.
* @param aIndexPos Position of aNode in mPossibleIndexes.
* @param _retval Returned node. Null if no sibling is found
* @returns Errorcode
*/
nsresult
nsTreeWalker::NextSiblingOf(nsINode* aNode,
PRBool aReversed,
PRInt32 aIndexPos,
nsINode** _retval)
{
nsresult rv;
nsCOMPtr<nsINode> node = aNode;
PRInt16 filtered;
PRInt32 childNum;
if (node == mRoot) {
*_retval = nsnull;
return NS_OK;
}
while (1) {
nsCOMPtr<nsINode> parent = node->GetNodeParent();
if (!parent)
break;
childNum = IndexOf(parent, node, aIndexPos);
NS_ENSURE_TRUE(childNum >= 0, NS_ERROR_UNEXPECTED);
// Search siblings
rv = ChildOf(parent, childNum, aReversed, aIndexPos, _retval);
NS_ENSURE_SUCCESS(rv, rv);
if (*_retval)
return NS_OK;
// Is parent the root?
if (parent == mRoot)
break;
// Is parent transparent in filtered view?
rv = TestNode(parent, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT)
break;
node = parent;
aIndexPos = aIndexPos < 0 ? -1 : aIndexPos-1;
}
*_retval = nsnull;
return NS_OK;
}
开发者ID:AllenDou,项目名称:firefox,代码行数:59,代码来源:nsTreeWalker.cpp
示例6: msg
void
SearchListView::ItemInvoked(void)
{
BIntegerField* pageField = (BIntegerField*)CurrentSelection()->GetField(0);
if (pageField == nullptr)
return;
BMessage msg(MSG_HIGHLIGHT_RECT);
msg.AddInt32("page", pageField->Value() - 1);
msg.AddRect("rect", fRectVec[IndexOf(CurrentSelection())]);
Window()->PostMessage(&msg);
BColumnListView::ItemInvoked();
}
开发者ID:humdingerb,项目名称:DocumentViewer,代码行数:15,代码来源:SearchView.cpp
示例7: switch
void
PrefListView::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case 'ITEM':
{
puts("We have a winner, supposably ;-)");
BPoint dropzone;
msg->FindPoint("_drop_point_", &dropzone);
dropzone = ConvertFromScreen(dropzone);
int32 i, nr;
msg->FindInt32("Item", &i);
msg->FindInt32("Item_nr", &nr);
XmlNode* Item = (XmlNode*)i;
XmlNode* toItem = dynamic_cast<XmlNode*>(ItemAt(IndexOf(dropzone)));
// Only proceed if valid
if (toItem && Item && toItem!=Item) {
XmlNode* parent = Item->Parent();
uint32 index = parent->IndexOf(Item);
uint32 toIndex = toItem->Parent()->IndexOf(toItem);
if (index<toIndex)
toIndex++;
parent->DetachChild(index);
if (toItem->Attribute(OPML_URL)!=NULL) {
toItem->Parent()->AddChild(Item, toIndex);
}
else {
toItem->AddChild(Item,0);
}
MakeEmpty();
BuildView(root);
Invalidate();
}
}
break;
default:
BOutlineListView::MessageReceived(msg);
}
}
开发者ID:DarkmatterVale,项目名称:fRiSS,代码行数:48,代码来源:fr_preflistview.cpp
示例8: RemoveResource
//! Returns false, if item is NULL or memory is insufficient, true otherwise.
bool
ResourcesContainer::AddResource(ResourceItem *item, int32 index, bool replace)
{
bool result = false;
if (item) {
// replace an item with the same type and id
if (replace)
delete RemoveResource(IndexOf(item->Type(), item->ID()));
int32 count = CountResources();
if (index < 0 || index > count)
index = count;
result = fResources.AddItem(item, count);
SetModified(true);
}
return result;
}
开发者ID:mariuz,项目名称:haiku,代码行数:17,代码来源:ResourcesContainer.cpp
示例9: IndexOf
bool
OverscrollHandoffChain::CanBePanned(const AsyncPanZoomController* aApzc) const
{
// Find |aApzc| in the handoff chain.
uint32_t i = IndexOf(aApzc);
// See whether any APZC in the handoff chain starting from |aApzc|
// has room to be panned.
for (uint32_t j = i; j < Length(); ++j) {
if (mChain[j]->IsPannable()) {
return true;
}
}
return false;
}
开发者ID:carriercomm,项目名称:system-addons,代码行数:16,代码来源:OverscrollHandoffState.cpp
示例10: Remove
void ff::SmallDict::Set(ff::StringRef key, Value *value)
{
if (value == nullptr)
{
Remove(key);
return;
}
size_t index = IndexOf(key);
if (index != INVALID_SIZE)
{
SetAt(index, value);
return;
}
Add(key, value);
}
开发者ID:FerretFaceGames,项目名称:ffcore,代码行数:17,代码来源:SmallDict.cpp
示例11: Looper
void DraggableListView::MouseDown(BPoint point) {
uint32 buttons = Looper()->CurrentMessage()->FindInt32("buttons");
int32 index = IndexOf(point);
if (buttons & B_SECONDARY_MOUSE_BUTTON && index >= 0) {
Select(index);
if (list_type == filter) {
BPopUpMenu popup_menu("popup_menu", false, false);
popup_menu.SetFont(be_plain_font);
BMessage* del_msg = new BMessage(SM_REMOVE_FILTER);
del_msg->AddInt32("filter_id", ((FilterItem*)ItemAt(index))->FilterID());
BMessage* help_msg = new BMessage(SM_HELP_REQUESTED);
help_msg->AddString("addon_name", ((FilterItem*)ItemAt(index))->Text());
popup_menu.AddItem(new BMenuItem("Delete", del_msg));
popup_menu.AddItem(new BMenuItem("Add-on Help"B_UTF8_ELLIPSIS, help_msg));
BMenuItem* item = popup_menu.Go(ConvertToScreen(point));
if (item != NULL) {
if (strcmp(item->Label(),"Delete") == 0) {
be_app_messenger.SendMessage(item->Message());
delete RemoveItem(index);
if (strcmp(item->Label(),"Add-on Help"B_UTF8_ELLIPSIS) == 0)
Window()->PostMessage(item->Message());
}
}
} else {
BView* active_list = Window()->FindView("active_list");
if (active_list != NULL) {
BPopUpMenu popup_menu("popup_menu", false, false);
popup_menu.SetFont(be_plain_font);
BMessage* add_msg = new BMessage(SM_DRAG_FILTER);
add_msg->AddString("filter_name", ((BStringItem*)ItemAt(index))->Text());
BMessage* help_msg = new BMessage(SM_HELP_REQUESTED);
help_msg->AddString("addon_name", ((BStringItem*)ItemAt(index))->Text());
popup_menu.AddItem(new BMenuItem("Add", add_msg));
popup_menu.AddItem(new BMenuItem("Add-on Help"B_UTF8_ELLIPSIS, help_msg));
BMenuItem* item = popup_menu.Go(ConvertToScreen(point));
if (item != NULL) {
if (strcmp(item->Label(),"Add") == 0)
active_list->MessageReceived(item->Message());
if (strcmp(item->Label(),"Add-on Help"B_UTF8_ELLIPSIS) == 0)
Window()->PostMessage(item->Message());
}
}
}
}
BListView::MouseDown(point);
}
开发者ID:HaikuArchives,项目名称:SoundMangler,代码行数:46,代码来源:DraggableListView.cpp
示例12: DeselectAll
/*****************************************************************************
* PlaylistView::CopyItems
*****************************************************************************/
void
PlaylistView::CopyItems( BList& items, int32 toIndex )
{
#if 0
DeselectAll();
// we remove the items while we look at them, the insertion index is decreased
// when the items index is lower, so that we insert at the right spot after
// removal
if ( fVlcWrapper->PlaylistLock() )
{
BList clonedItems;
int32 count = items.CountItems();
// remember currently playing item
BListItem* playingItem = _PlayingItem();
// collect cloned item pointers
for ( int32 i = 0; i < count; i++ )
{
int32 index = IndexOf( (BListItem*)items.ItemAt( i ) );
void* item = fVlcWrapper->PlaylistItemAt( index );
void* cloned = fVlcWrapper->PlaylistCloneItem( item );
if ( cloned && !clonedItems.AddItem( cloned ) )
free( cloned );
}
// add cloned items at index
int32 index = toIndex;
for ( int32 i = 0; void* item = clonedItems.ItemAt( i ); i++ )
{
if ( fVlcWrapper->PlaylistAddItem( item, index ) )
// next items will be inserted after this one
index++;
else
free( item );
}
// update GUI
DragSortableListView::CopyItems( items, toIndex );
// restore currently playing item
_SetPlayingIndex( playingItem );
// update interface (in case it isn't playing,
// there is a chance that it needs to update)
fMainWindow->PostMessage( MSG_UPDATE );
fVlcWrapper->PlaylistUnlock();
}
#endif
}
开发者ID:forthyen,项目名称:SDesk,代码行数:48,代码来源:ListViews.cpp
示例13: IndexOf
int SudokuGrid::Value(int row, int column) const noexcept
{
int index = IndexOf(row, column);
int result = NoValues;
for (int i = 0; i < 9; ++i)
{
if (!_banned.test(index + i))
{
if (result == NoValues)
result = i;
else
return MultipleValues;
}
}
return result;
}
开发者ID:TheBuzzSaw,项目名称:ProjectEuler,代码行数:18,代码来源:SudokuGrid.cpp
示例14: ASSERT
void CMessageBox::AddButton(const CString & strCaption, UINT id, bool bEnabled/*=true*/)
{
#ifdef _DEBUG
ASSERT(-1==IndexOf(id));
for(unsigned int i=0;i<ButtonCount();i++){
if(0==m_arBInfo[i].m_strCaption.Compare(strCaption)){
ASSERT(FALSE);
}
}
#endif
if(bEnabled){
if(IDCANCEL==id || (IDOK==id && -1==m_nEscapeButton)){
m_nEscapeButton=ButtonCount();
}
}
CButtonInfo info(id,bEnabled,strCaption);
m_arBInfo.Add(info);
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:18,代码来源:messagebox.cpp
示例15: switch
void
AudioListView::MessageReceived(BMessage* message)
{
switch (message->what) {
case kDraggedItem:
{
BPoint dropPoint = message->DropPoint();
int32 dropIndex = IndexOf(ConvertFromScreen(dropPoint));
int32 count = CountItems();
if (dropIndex < 0 || dropIndex > count)
dropIndex = count;
BList indices;
GetSelectedItems(indices);
MoveItems(indices, dropIndex);
RenumberTracks();
break;
}
case kDeleteItem:
{
if (!IsEmpty()) {
RemoveSelected();
if (!IsEmpty())
RenumberTracks();
}
// fake to update button state and calculate SizeBar
Looper()->PostMessage(B_REFS_RECEIVED);
break;
}
case kPopupClosed:
{
fShowingPopUpMenu = false;
break;
}
default:
{
BListView::MessageReceived(message);
break;
}
}
}
开发者ID:HaikuArchives,项目名称:BurnItNow,代码行数:43,代码来源:AudioList.cpp
示例16: LoadUtilityPluginL
/**
Attempt to load the DLL file named in aSupInfo. If successful, instantiate, initialize and start
the contained uitility plugin using the ordinal function specified in aSupInfo and the MSsmUtility
interface.
@internalComponent
@released
*/
void CSusUtilServer::LoadUtilityPluginL(TSsmSupInfo& aSupInfo)
{
RLibrary lib;
SusPluginLoader::LoadDllFileLC(lib, aSupInfo); // open handle on CleanupStack
if (KErrNotFound != IndexOf(lib, aSupInfo.NewLOrdinal()))
{
//will leave in release builds as well
SSMLOGLEAVE(KErrAlreadyExists); //lint !e527 Unreachable
}
const TInt newL = aSupInfo.NewLOrdinal();
CSusPluginFrame* plugin = SusPluginLoader::CreatePluginLC(lib, newL);
iLoadedPlugins.AppendL(plugin);
CleanupStack::Pop(plugin);
plugin->SetLibrary(lib); // takes ownership of open library handle
CleanupStack::Pop(&lib);
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:26,代码来源:susutilserver.cpp
示例17: lock
eDynamicDeviceReturnCode cDynamicDevice::SetGetTSTimeoutHandlerArg(const char *DevPath, const char *Arg)
{
if (!DevPath || !Arg)
return ddrcNotSupported;
cMutexLock lock(&arrayMutex);
int freeIndex = -1;
int index = -1;
if (isnumber(DevPath))
index = strtol(DevPath, NULL, 10) - 1;
else
index = IndexOf(DevPath, freeIndex, -1);
if ((index < 0) || (index >= numDynamicDevices))
return ddrcNotFound;
dynamicdevice[index]->InternSetGetTSTimeoutHandlerArg(Arg);
return ddrcSuccess;
}
开发者ID:flensrocker,项目名称:vdr-plugin-dynamite,代码行数:19,代码来源:dynamicdevice.c
示例18: printf
bool ListView1::InitiateDrag(BPoint point, bool wasSelected) {
printf("InitiateDrag():");
point.PrintToStream();
BRow *row=FocusRow();
if (row==NULL) return false;
/*
if ((CDMode==DATACD_INDEX) || (CDMode==BOOTABLECD_INDEX)) { // yes? then we are not in audio mode
folderRow=new FolderRow(((FolderRow *)row)->GetFilename(),
((FolderRow *)row)->IsFolder(),
((FolderRow *)row)->GetBitmap());
} else */
if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX)){
audioRow=new AudioRow(((AudioRow *)row)->GetTrackNumber(),((AudioRow *)row)->GetFilename(),
((AudioRow *)row)->GetPregap(),
((AudioRow *)row)->GetBytes(),
((AudioRow *)row)->GetLength());
audioRow->SetCDTitle(((AudioRow *)row)->GetCDTitle());
audioRow->SetIndexList(((AudioRow *)row)->GetIndexList());
audioRow->SetPregap(((AudioRow *)row)->GetPregap());
audioRow->SetStartFrame(((AudioRow *)row)->GetStartFrame());
audioRow->SetEndFrame(((AudioRow *)row)->GetEndFrame());
// audioRow->SetStartTime(((AudioRow *)row)->GetStartTime());
// audioRow->SetEndTime(((AudioRow *)row)->GetEndTime());
//audioRow=new AudioRow(*((AudioRow *)row));
}
BMessage *message=new BMessage(LISTITEM_DROPPED);
BRect rect;
if (GetRowRect(row, &rect)) {
void *r=(void *)row;
message->AddPointer("from", r);
if (!((FolderRow *)row)->IsFolder())
message->AddInt32("index", (int32)IndexOf(row));
DragMessage(message, rect);
// if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX))
// RemoveRow(IndexOf(row));
//delete row;
}
return true;
}
开发者ID:carriercomm,项目名称:Helios,代码行数:41,代码来源:ListView1.cpp
示例19: ASSERT
CXTPControl* CXTPRibbonGroup::SetControlType(CXTPControl* pControl, XTPControlType type)
{
ASSERT(pControl);
if (!pControl)
return NULL;
if (IsPopupControlType(pControl->GetType()) && IsPopupControlType(type))
{
pControl->m_controlType = type;
return pControl;
}
CXTPControl* pNew = Add(type, 0, _T(""), IndexOf(pControl) + 1, FALSE);
pNew->CXTPControl::Copy(pControl, FALSE);
pNew->m_controlType = type;
Remove(pControl);
return pNew;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:21,代码来源:XTPRibbonGroup.cpp
示例20: IndexOf
bool
PrefListView::InitiateDrag(BPoint point, int32 index, bool wasSelected)
{
BOutlineListView::InitiateDrag(point,index,wasSelected);
if (wasSelected) {
int idx = IndexOf(point);
if (idx == B_ERROR)
return false;
BStringItem* item = (BStringItem*)ItemAt(idx);
BRect r = ItemFrame(idx);
BMessage msg('ITEM');
msg.AddInt32("Item", (int)item);
msg.AddInt32("Item_nr", (int)index);
msg.AddPoint("click_location", point);
DragMessage( &msg, r, NULL );
return true;
}
return false;
}
开发者ID:DarkmatterVale,项目名称:fRiSS,代码行数:21,代码来源:fr_preflistview.cpp
注:本文中的IndexOf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论