当前位置: 首页>>代码示例>>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;未经允许,请勿转载。