當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetIndex函數代碼示例

本文整理匯總了C++中GetIndex函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetIndex函數的具體用法?C++ GetIndex怎麽用?C++ GetIndex使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetIndex函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: if

void CColourPopup::OnMouseMove(UINT nFlags, CPoint point) 
{
    int nNewSelection = INVALID_COLOUR;

    // Translate points to be relative raised window edge
    point.x -= m_nMargin;
    point.y -= m_nMargin;

    // First check we aren't in text box
    if (m_strCustomText.GetLength() && m_CustomTextRect.PtInRect(point))
        nNewSelection = CUSTOM_BOX_VALUE;
    else if (m_strDefaultText.GetLength() && m_DefaultTextRect.PtInRect(point))
        nNewSelection = DEFAULT_BOX_VALUE;
    else
    {
        // Take into account text box
        if (m_strDefaultText.GetLength()) 
            point.y -= m_DefaultTextRect.Height();  

        // Get the row and column
        nNewSelection = GetIndex(point.y / m_nBoxSize, point.x / m_nBoxSize);

        // In range? If not, default and exit
        if (nNewSelection < 0 || nNewSelection >= m_nNumColours)
        {
            CWnd::OnMouseMove(nFlags, point);
            return;
        }
    }

    // OK - we have the row and column of the current selection (may be CUSTOM_BOX_VALUE)
    // Has the row/col selection changed? If yes, then redraw old and new cells.
    if (nNewSelection != m_nCurrentSel)
        ChangeSelection(nNewSelection);

    CWnd::OnMouseMove(nFlags, point);
}
開發者ID:Jichao,項目名稱:comtut,代碼行數:37,代碼來源:ColourPopup.cpp

示例2: GetIndex

void DlgPalette::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
    long x = point.x - m_xoffset;
    long y = point.y - m_yoffset;

	if (x>=0 && y>=0){
		long i = GetIndex(y / (m_boxheight+m_boxgap), x / (m_boxwidth+m_boxgap));

		if (i>=0 && i<m_numcolors){

			COLORREF c;

			if (m_editalpha)
				c=RGB(m_pal[i].rgbReserved,m_pal[i].rgbReserved,m_pal[i].rgbReserved);
			else
				c=RGB(m_pal[i].rgbRed,m_pal[i].rgbGreen,m_pal[i].rgbBlue);

	        CColorDialog dlg(c,	CC_FULLOPEN | CC_ANYCOLOR, this);

			if (dlg.DoModal() == IDOK){
				c = dlg.GetColor();
				if (m_editalpha){
					m_pal[i].rgbReserved=GetRValue(c);
				} else {
					m_pal[i].rgbRed=GetRValue(c);
					m_pal[i].rgbGreen=GetGValue(c);
					m_pal[i].rgbBlue=GetBValue(c);
				}
				m_changed=1;
				m_selected=i;
				Invalidate(1);
			}
		}
	}

	CDialog::OnLButtonDblClk(nFlags, point);
}
開發者ID:axDev-toolchain,項目名稱:benchmark,代碼行數:37,代碼來源:DlgPalette.cpp

示例3: CDictionaryBasedTempPath

CDictionaryBasedTempPath CDictionaryBasedTempPath::GetCommonRoot
    (const CDictionaryBasedTempPath& rhs) const
{
    // short-cut: different base directories anyway?

    if (rhs.GetIndex() != GetIndex())
        return CDictionaryBasedTempPath (inherited::GetCommonRoot (rhs));

    // match relative paths

    typedef std::vector<std::string>::const_iterator IT;
    IT begin = relPathElements.begin();
    IT end = relPathElements.end();
    IT iter = begin;

    IT rhsEnd = relPathElements.end();
    IT rhsIter = relPathElements.begin();

    while ((iter != end) && (rhsIter != rhsEnd) && (*iter == *rhsIter))
    {
        ++iter;
        ++rhsIter;
    }

    // construct the result

    CDictionaryBasedTempPath result (GetBasePath());
    result.relPathElements.insert (result.relPathElements.begin(), begin, iter);

    // update the debug-only _path member

#ifdef _DEBUG
    result._path = result.GetPath();
#endif

    return result;
}
開發者ID:TortoiseGit,項目名稱:tortoisesvn,代碼行數:37,代碼來源:DictionaryBasedTempPath.cpp

示例4: TakeFloatValues

// Read values from a text file or terminal
static
void TakeFloatValues(cmsFloat64Number Float[])
{
    cmsUInt32Number i, n;
    char ChannelName[cmsMAX_PATH];
    char Buffer[cmsMAX_PATH];

    if (xisatty(stdin))
        fprintf(stderr, "\nEnter values, 'q' to quit\n");

    if (InputNamedColor) {

        // This is named color index, which is always cmsUInt16Number
        cmsUInt16Number index = GetIndex();
        memcpy(Float, &index, sizeof(cmsUInt16Number));
        return;
    }

    n = cmsChannelsOf(InputColorSpace);
    for (i=0; i < n; i++) {

        if (InputColorant) {
            cmsNamedColorInfo(InputColorant, i, ChannelName, NULL, NULL, NULL, NULL);          
        }
        else {
            InputRange = 1;
            sprintf(ChannelName, "Channel #%u", i+1);
        }

        GetLine(Buffer, "%s? ", ChannelName);

        Float[i] = (cmsFloat64Number) atof(Buffer) / InputRange;
    }       

    if (xisatty(stdin))
        fprintf(stderr, "\n");
}
開發者ID:ScaledLizard,項目名稱:ResIL,代碼行數:38,代碼來源:transicc.c

示例5: TEST

    TEST(NativeCode, AndRowJzMatches)
    {
        ShardId c_numShards = 1;
        char const * text =
            "LoadRowJz {"
            "  Row: Row(0, 0, 0, false),"
            "  Child: AndRowJz {"
            "    Row: Row(1, 0, 0, false),"
            "    Child: AndRowJz {"
            "      Row: Row(2, 0, 0, false),"
            "      Child: Report {"
            "        Child: "
            "      }"
            "    }"
            "  }"
            "}";

        const Rank initialRank = 0;
        NativeCodeVerifier verifier(GetIndex(c_numShards), initialRank);

        verifier.DeclareRow("2");
        verifier.DeclareRow("3");
        verifier.DeclareRow("5");

        for (auto iteration : verifier.GetIterations())
        {
            const size_t slice = verifier.GetSliceNumber(iteration);
            const size_t offset = verifier.GetOffset(iteration);

            const uint64_t row0 = verifier.GetRowData(0, offset, slice);
            const uint64_t row1 = verifier.GetRowData(1, offset, slice);
            const uint64_t row2 = verifier.GetRowData(2, offset, slice);
            verifier.ExpectResult(row0 & row1 & row2, offset, slice);
        }

        verifier.Verify(text);
    }
開發者ID:BitFunnel,項目名稱:BitFunnel,代碼行數:37,代碼來源:NativeCodeTest.cpp

示例6: FillInsertKeyList

DefTableKeyList FillInsertKeyList (DefTableKeyList orig)
{ DefTableKeyList missing = NULLDefTableKeyList, l = orig;
  int index = 1;
  while (l != NULLDefTableKeyList)
  { DefTableKey insKey = HeadDefTableKeyList (l);
    int elemindex = GetIndex (insKey, index);
    while (index < elemindex)
    { DefTableKey newk = NewKey ();
      ResetType (newk, nodeType); 
      ResetIndex (newk, index++);
      ResetUsed (newk, 0);
      missing = ConsDefTableKeyList (newk, missing);
    }
    index++;
    l = TailDefTableKeyList (l);
  }
  while (missing != NULLDefTableKeyList)
  { DefTableKey insKey = HeadDefTableKeyList (missing);
    orig = AddToOrderedSetDefTableKeyList
             (insKey, orig, cmpPatIndex);
    missing = TailDefTableKeyList (missing);
  }
  return orig;
}
開發者ID:LukeMeszar,項目名稱:CAS,代碼行數:24,代碼來源:insertKey.c

示例7: one

/**
Adds a recognition result to the hash map of the particular directory.
This is only done if it isn't already existing.
The return value specifies if the number of entries was increased by one (ETrue) or not.
@internalComponent
*/
TBool CRecognitionResultHashMap::AddL(const TDesC& aKey, TTime aLastModified, const TDataRecognitionResult& aResult)
	{
	const TUint index = GetIndex(aKey);

	//check if there already is an entry for the file
	for(CRecognitionResultHashMapEntry* entry = Entry(index); entry; entry = entry->Next())
		{
		if(entry->FileName().Compare(aKey) == 0)
			{
			// already there -> check modification date
			if( entry->LastModified() != aLastModified )
				{
				entry->UpdateL(aLastModified, aResult);
				}

			return EFalse;
			}
		}

	//create new entry
	SetEntry(index, CRecognitionResultHashMapEntry::NewL(aKey, aLastModified, aResult, Entry(index)));
	iNumberOfEntries++;
	return ETrue;
	}
開發者ID:cdaffara,項目名稱:symbiandump-mw1,代碼行數:30,代碼來源:APSRECCACHE.cpp

示例8: SET_SIZE

void NPC::Spawn(Vector origin)
{
	pev->solid = SOLID_BBOX;
	pev->takedamage = DAMAGE_AIM;
	pev->deadflag = DEAD_NO;
	pev->health = pev->max_health;
	pev->fixangle = true;

	SET_SIZE(GetEntity(), g_npcSize[0], g_npcSize[1]);
	SET_ORIGIN(GetEntity(), origin);

	m_pmodel = null;

	DROP_TO_FLOOR(GetEntity());

	pev->animtime = gpGlobals->time;
	pev->nextthink = m_nextThinkTime = gpGlobals->time + 0.2f;
	m_frameInterval = gpGlobals->time;

	m_iDamage = false;
	SetEntityAction(GetIndex(), m_npcTeam, 1);

	m_workNPC = true;
}
開發者ID:CCNHsK-Dev,項目名稱:SyPB,代碼行數:24,代碼來源:npc_ai.cpp

示例9:

void RoutesPage::ClickDelete2(int result)
{
	int i;
	GPXRoute *f;

	if(result==MSGBOX_YES)
	{
		i=GetIndex(m_editroutelist.GetSelectionString());
		if(i>=0)
		{
			f=m_routes.GetEntry(i);
			delete f;
			m_routes.DeleteEntry(i);
			--m_numroutes;
			m_editroutelist.SetSelection(0);

			UpdateRouteList();
			Load();
			//SavePrefs();
			return;
		}
		assert(false,"route not found!");
	}
}
開發者ID:neolu,項目名稱:gpsturbo,代碼行數:24,代碼來源:routes.cpp

示例10: GetIndex

	void GCAlloc::SweepGuts(GCBlock *b)
	{	
		// TODO: MMX version for IA32
		uint32_t *bits = (uint32_t*) b->GetBits();
		uint32_t count = b->nextItem ? GetIndex(b, b->nextItem) : m_itemsPerBlock;
		// round up to eight
		uint32_t numInts = ((count+7)&~7) >> 3;
		for(uint32_t i=0; i < numInts; i++) 
		{
			uint32_t marks = bits[i];
			// hmm, is it better to screw around with exact counts or just examine
			// 8 items on each pass, with the later we open the door to unrolling
			uint32_t subCount = i==(numInts-1) ? ((count-1)&7)+1 : 8;
			for(uint32_t j=0; j<subCount;j++,marks>>=4)
			{
				int mq = marks & kFreelist;
				if(mq == kMark || mq == kQueued)	// Sweeping is lazy; don't sweep objects on the mark stack
				{
					// live item, clear bits
					bits[i] &= ~(kFreelist<<(j*4));
					continue;					
				}

				 if(mq == kFreelist)
					 continue; // freelist item, ignore

				// garbage, freelist it
				void *item = (char*)b->items + m_itemSize*(i*8+j);
#ifdef MMGC_HOOKS
				if(m_gc->heap->HooksEnabled())
					m_gc->heap->FreeHook(GetUserPointer(item), b->size - DebugSize(), 0xba);
#endif
				b->FreeItem(item, (i*8+j));
			}
		}
	}
開發者ID:Jeffxz,項目名稱:nodeas,代碼行數:36,代碼來源:GCAlloc.cpp

示例11: GetIndex

// ---------------------------------------------------------------------
// GETINDEX (astral coordinates version)
unsigned short int GetIndex(trixel* trixel, double& ra, double& dec)
{
    if (IsCorrectRA(ra) && IsCorrectDEC(dec))
    {
        double rProjection = sin(90 - abs(dec));
        double x = rProjection * cos(ra);
        double y = rProjection * sin(ra);
        double z = cos(90 - abs(dec));
        Eigen::Vector3d p(x, y, z);
        unsigned short int ret = GetIndex(trixel, p);
        if (ret == max<unsigned short>()) // Is it not good ..?
        {
            // Did nothing in the first place...
        }
        return ret;
    }
    else
    {
        llog::warn["HTM"]
            << "Given <ra> [" << ra << "] or <dec> [" << dec << "] is out of bounds"
            << std::endl;
    }
    return max<unsigned short>();
}
開發者ID:chipot,項目名稱:LandySzalayEstimator,代碼行數:26,代碼來源:trixel.cpp

示例12: Modify

bool UMovieScene::RemovePossessable( const FGuid& PossessableGuid )
{
	bool bAnythingRemoved = false;

	for( auto PossesableIter( Possessables.CreateIterator() ); PossesableIter; ++PossesableIter )
	{
		auto& CurPossesable = *PossesableIter;

		if( CurPossesable.GetGuid() == PossessableGuid )
		{	
			Modify();

			// Found it!
			Possessables.RemoveAt( PossesableIter.GetIndex() );

			RemoveObjectBinding( PossessableGuid );

			bAnythingRemoved = true;
			break;
		}
	}

	return bAnythingRemoved;
}
開發者ID:Tigrouzen,項目名稱:UnrealEngine-4,代碼行數:24,代碼來源:MovieScene.cpp

示例13: _tcschr

BOOL CCoolMenuBarCtrl::OpenMenuChar(UINT nChar)
{
	CMenu pMenu;
	pMenu.Attach( m_hMenu );

	for ( UINT nItem = 0 ; nItem < pMenu.GetMenuItemCount() ; nItem++ )
	{
		CString strMenu;
		pMenu.GetMenuString( nItem, strMenu, MF_BYPOSITION );

		LPCTSTR pszChar = _tcschr( strMenu, '&' );
		if ( ! pszChar++ ) continue;

		if ( toupper( *pszChar ) == toupper( nChar ) )
		{
			pMenu.Detach();
			if ( m_pSelect = GetIndex( nItem ) ) PostMessage( WM_TIMER, 5 );
			return TRUE;
		}
	}

	pMenu.Detach();
	return FALSE;
}
開發者ID:pics860,項目名稱:callcenter,代碼行數:24,代碼來源:CtrlCoolMenuBar.cpp

示例14: OnInitDialog

BOOL CKeyshortcutsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	m_ctrlCBRecord.SetCurSel(GetIndex(cHotKeyOpts.m_RecordStart.m_vKey));
	m_ctrlCBStop.SetCurSel(GetIndex(cHotKeyOpts.m_RecordEnd.m_vKey));
	m_ctrlCBCancel.SetCurSel(GetIndex(cHotKeyOpts.m_RecordCancel.m_vKey));
	m_ctrlCBNext.SetCurSel(GetIndex(cHotKeyOpts.m_Next.m_vKey));
	m_ctrlCBPrev.SetCurSel(GetIndex(cHotKeyOpts.m_Prev.m_vKey));
	m_ctrlCBShow.SetCurSel(GetIndex(cHotKeyOpts.m_ShowLayout.m_vKey));
	m_ctrlCBAutopan.SetCurSel(GetIndex(cHotKeyOpts.m_Autopan.m_vKey));

	m_ctrlButtonRecordCTRL.SetCheck((cHotKeyOpts.m_RecordStart.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonStopCTRL.SetCheck((cHotKeyOpts.m_RecordEnd.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonCancelCTRL.SetCheck((cHotKeyOpts.m_RecordCancel.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonNextCTRL.SetCheck((cHotKeyOpts.m_Next.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonPrevCTRL.SetCheck((cHotKeyOpts.m_Prev.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonShowCTRL.SetCheck((cHotKeyOpts.m_ShowLayout.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonAutoSpanCTRL.SetCheck((cHotKeyOpts.m_Autopan.m_fsMod & MOD_CONTROL) > 0);

	m_ctrlButtonRecordALT.SetCheck((cHotKeyOpts.m_RecordStart.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonStopALT.SetCheck((cHotKeyOpts.m_RecordEnd.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonCancelALT.SetCheck((cHotKeyOpts.m_RecordCancel.m_fsMod) > 0);
	m_ctrlButtonNextALT.SetCheck((cHotKeyOpts.m_Next.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonPrevALT.SetCheck((cHotKeyOpts.m_Prev.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonShowALT.SetCheck((cHotKeyOpts.m_ShowLayout.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonAutoSpanALT.SetCheck((cHotKeyOpts.m_Autopan.m_fsMod & MOD_ALT) > 0);

	m_ctrlButtonRecordSHFT.SetCheck((cHotKeyOpts.m_RecordStart.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonStopSHFT.SetCheck((cHotKeyOpts.m_RecordEnd.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonCancelSHFT.SetCheck((cHotKeyOpts.m_RecordCancel.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonNextSHFT.SetCheck((cHotKeyOpts.m_Next.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonPrevSHFT.SetCheck((cHotKeyOpts.m_Prev.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonShowCHFT.SetCheck((cHotKeyOpts.m_ShowLayout.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonAutoSpanSHFT.SetCheck((cHotKeyOpts.m_Autopan.m_fsMod & MOD_SHIFT) > 0);
	return TRUE; // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
開發者ID:MindFy,項目名稱:camstudio,代碼行數:38,代碼來源:Keyshortcuts.cpp

示例15: if

void Scene_Debug::Update() {
	range_window->Update();
	if (range_index != range_window->GetIndex()){
		range_index = range_window->GetIndex();
		var_window->UpdateList(range_page * 100 + range_index * 10 + 1);
		var_window->Refresh();
	}
	var_window->Update();

	if (numberinput_window->GetActive())
		numberinput_window->Update();

	if (Input::IsTriggered(Input::CANCEL)) {
		Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cancel));
		if (range_window->GetActive())
			Scene::Pop();
		else if (var_window->GetActive()) {
			var_window->SetActive(false);
			range_window->SetActive(true);
			var_window->Refresh();
		} else if (numberinput_window->GetActive()) {
			numberinput_window->SetVisible(false);
			numberinput_window->SetActive(false);
			var_window->SetActive(true);
		}
	} else if (Input::IsTriggered(Input::DECISION)) {
		var_window->Refresh();
		if (range_window->GetActive()) {
			range_window->SetActive(false);
			var_window->SetActive(true);
		} else if (var_window->GetActive()) {
			if (current_var_type == TypeSwitch && Game_Switches.IsValid(GetIndex()))
				Game_Switches[GetIndex()] = !Game_Switches[GetIndex()];
			else if (current_var_type == TypeInt && Game_Variables.IsValid(GetIndex())) {
				var_window->SetActive(false);
				numberinput_window->SetNumber(Game_Variables[GetIndex()]);
				numberinput_window->SetVisible(true);
				numberinput_window->SetActive(true);
			}
			var_window->Refresh();
		} else if (numberinput_window->GetActive()) {
			Game_Variables[GetIndex()] = numberinput_window->GetNumber();
			numberinput_window->SetActive(false);
			numberinput_window->SetVisible(false);
			var_window->SetActive(true);
			var_window->Refresh();
		}
		Game_Map::SetNeedRefresh(Game_Map::Refresh_All);
	} else if (range_window->GetActive() &&  Input::IsTriggered(Input::RIGHT)) {
		range_page++;
		if (current_var_type == TypeSwitch && !Game_Switches.IsValid(range_page*100+1)) {
			range_page = 0;
			current_var_type = TypeInt;
			var_window->SetShowSwitch(false);
		} else if (current_var_type == TypeInt && !Game_Variables.IsValid(range_page*100+1)) {
			range_page = 0;
			current_var_type = TypeSwitch;
			var_window->SetShowSwitch(true);
		}
		var_window->UpdateList(range_page * 100 + range_index * 10 + 1);
		UpdateRangeListWindow();
		var_window->Refresh();
	} else if (range_window->GetActive() && Input::IsTriggered(Input::LEFT)) {
		range_page--;
		if (current_var_type == TypeSwitch && range_page < 0) {
			range_page = 0;
			for (;;)
				if (Game_Variables.IsValid(range_page*100 + 101))
					range_page++;
				else
					break;
			current_var_type = TypeInt;
			var_window->SetShowSwitch(false);
		} else if (current_var_type == TypeInt && range_page < 0) {
			range_page = 0;
			for (;;)
				if (Game_Switches.IsValid(range_page*100 + 101))
					range_page++;
				else
					break;
			current_var_type = TypeSwitch;
			var_window->SetShowSwitch(true);
		}
		var_window->UpdateList(range_page * 100 + range_index * 10 + 1);
		UpdateRangeListWindow();
		var_window->Refresh();
	}
}
開發者ID:FaithFeather,項目名稱:Player,代碼行數:88,代碼來源:scene_debug.cpp


注:本文中的GetIndex函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。