• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FindKey函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FindKey函数的典型用法代码示例。如果您正苦于以下问题:C++ FindKey函数的具体用法?C++ FindKey怎么用?C++ FindKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FindKey函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DisplayKey

/****************************************************************************
PARAMETERS:
msg - Message to display for type of event
evt - Event to display

REMARKS:
Function to display the status of the keyboard event to the screen.
****************************************************************************/
void DisplayKey(
    char *msg,
    event_t *evt)
{
    KeyEntry    *ascii,*scan;
    char        ch = EVT_asciiCode(evt->message);

    ascii = FindKey(ch,ASCIICodes);
    scan = FindKey(EVT_scanCode(evt->message),ScanCodes);
    printf("%s: 0x%04X -> %s, %s, '%c'",
	msg, (int)evt->message & 0xFFFF, scan->name, ascii->name, isprint(ch) ? ch : ' ');
    DisplayModifiers(evt);
    printf("\n");
}
开发者ID:A1DEVS,项目名称:lenovo_a1_07_uboot,代码行数:22,代码来源:getch.c


示例2: IsNeedLoadFunc

int IsNeedLoadFunc(const FuncInfo *func)
{
	KeyInfo *key = NULL;
	gboolean load = TRUE;
	if((func != NULL) && (func->func_id != NULL)){
		load = FindKey(func->func_id, g_cngplp_data);
		if((func->func_id->type != NULL) && (0 == strcmp(func->func_id->type, "or"))){
			if(load == TRUE){
				return TRUE;
			}
		}else{
			if(load == TRUE){
				key = func->key_list;
				while(key != NULL){
					load = FindKey(key, g_cngplp_data);
					if((key->type != NULL) && (0 == strcmp(key->type, "or"))){
						if(load == TRUE){
							return TRUE;
						}
					}else{
						if(load != TRUE){
							return FALSE;
						}
					}
					key = key->next;
				}
			}else{
				load = FALSE;
			}
		}
	}else{
		key = func->key_list;
		while(key != NULL){
			load = FindKey(key, g_cngplp_data);
			if((key->type != NULL) && (0 == strcmp(key->type, "or"))){
				if(load == TRUE){
					return TRUE;
				}
			}else{
				if(load != TRUE){
					return FALSE;
				}
			}
			key = key->next;
		}
	}
	return load;
}
开发者ID:anymex,项目名称:cndrvcups-lb,代码行数:48,代码来源:controller.c


示例3: GetStr

void CIni::GetStr(const char* pszIndex, const char* pszKey,
			const char* pszDefault,
			char* szBuf, int nBufLen)
{
	if( pszIndex==NULL||pszKey==NULL|| pszDefault==NULL
		||szBuf==NULL||nBufLen<=0) return ;


	int nIndexPos = 0;
	int nKeyPos = 0;
	int nRet= 0 ;
	char szValueBuf[MAX_VALUE_BUF_LEN]={0};
	 if( (nIndexPos =FindIndex(pszIndex))!=-1)
	 {
		 if( (nKeyPos = FindKey(pszKey, nIndexPos))!=-1)
		 {
			if(GetValue(nKeyPos,szValueBuf,MAX_VALUE_BUF_LEN))
			{
				if(strlen(szValueBuf)<=nBufLen)
					strcpy(szBuf, szValueBuf);
				return;
			}
			
		 }
	 }
	if(strlen(pszDefault)<=nBufLen)
		strcpy(szBuf, pszDefault);
	else
		strcpy(szBuf,"");
}
开发者ID:eickegao,项目名称:avgscript,代码行数:30,代码来源:Ini.cpp


示例4: WriteString

/*=========================================================================
   WriteString : Writes a string to the ini file
*========================================================================*/
void CIniFile::WriteString (CCHR *pSection, CCHR *pKey, CCHR *pValue)
{
	EFIND List;
	char  Str [255];

	if (ArePtrValid (pSection, pKey, pValue) == FALSE) { return; }
	if (FindKey  (pSection, pKey, &List) == TRUE)
	{
		sprintf (Str, "%s=%s%s", List.KeyText, pValue, List.Comment);
		FreeMem (List.pKey->pText);
		List.pKey->pText = (char *)malloc (strlen (Str)+1);
		strcpy (List.pKey->pText, Str);
	}
	else
	{
		if ((List.pSec != NULL) && (List.pKey == NULL)) // section exist, Key not 
		{
			AddKey (List.pSec, pKey, pValue);
		}
		else
		{
			AddSectionAndKey (pSection, pKey, pValue);
		}
	}
}
开发者ID:zhlgh603,项目名称:contron-psm70,代码行数:28,代码来源:IniFile.cpp


示例5: FindClass

 size_t FindClass(char const* name, bool assume_sorted = false) const
 {
   if (assume_sorted)
     return FindSortedKey(csArrayCmp<scfFactory*,char const*>(name,
       CompareClass));
   return FindKey(csArrayCmp<scfFactory*,char const*>(name, CompareClass));
 }
开发者ID:garinh,项目名称:cs,代码行数:7,代码来源:scf.cpp


示例6: while

/*
================
idDict::Parse
================
*/
bool idDict::Parse( idParser &parser ) {
	idToken	token;
	idToken	token2;
	bool	errors;

	errors = false;

	parser.ExpectTokenString( "{" );
	parser.ReadToken( &token );
	while( ( token.type != TT_PUNCTUATION ) || ( token != "}" ) ) {
		if ( token.type != TT_STRING ) {
			parser.Error( "Expected quoted string, but found '%s'", token.c_str() );
		}

		if ( !parser.ReadToken( &token2 ) ) {
			parser.Error( "Unexpected end of file" );
		}

		if ( FindKey( token ) ) {
			parser.Warning( "'%s' already defined", token.c_str() );
			errors = true;
		}
		Set( token, token2 );

		if ( !parser.ReadToken( &token ) ) {
			parser.Error( "Unexpected end of file" );
		}
	}

	return !errors;
}
开发者ID:Afr0,项目名称:idtech4.net,代码行数:36,代码来源:Dict.cpp


示例7:

//-----------------------------------
/// extract string (in double-quotes) from the list.
// pass the key to find the first string in the list, else NULL to find the next string in the list
// returns NULL if no string found, else returns a temporary copy of the string (without quotes)
char * CConfig::GetString(char *key)
//-----------------------------------
{
    if (!FindKey(key))
		return NULL;


    // look for start of string or end of key
	while (*pCursor && *pCursor != '"' && *pCursor != '[')	
		pCursor++;
	if (*(pCursor++) != '"')
		return NULL;

    // until closing quote
    int c = 0;
	while (*pCursor && c < (int)sizeof(strBuffer))	
	{
		strBuffer[c++] = *pCursor;									// extract string
		if (*pCursor++ == '"')
		{
			strBuffer[--c] = '\0';
			return strBuffer;
		}
	}

	return NULL;
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:31,代码来源:Config.cpp


示例8: FindSection

// function retrieves a boolean from the specified section
bool GProfile::GetBool(const char *szSectionName, const char *szKey, bool bThrowNotFound /* = true */)
{
	GProfileSection *pSection = FindSection(szSectionName);
	if (pSection)
	{
		GProfileEntry *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if (!pNVP->m_strValue.IsEmpty())
			{
				if (pNVP->m_strValue.GetAt(0) == '1')
					return 1;
				if (pNVP->m_strValue.CompareNoCase("Yes") == 0)
					return 1;
				if (pNVP->m_strValue.CompareNoCase("On") == 0)
					return 1;
			}
			return 0;
		}
		else if (bThrowNotFound)
		{
			// throw key not found
			throw GException("Profile", 0, szSectionName, szKey);
		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found
		throw GException("Profile", 1, szSectionName);
	}

	return 0;
}
开发者ID:BrianAberle,项目名称:XMLFoundation,代码行数:34,代码来源:GProfile.cpp


示例9: FindSection

const char *GProfile::GetPath(const char *szSectionName, const char *szKey, short bThrowNotFound)
{
	Section *pSection = FindSection(szSectionName);
	if (pSection)
	{
		NameValuePair *pNVP = FindKey(szKey, pSection);
		if (pNVP)
		{
			if ( !( pNVP->m_strValue.Right(1) == "/" || pNVP->m_strValue.Right(1) == "\\") )
			{
		#ifdef _WIN32
				pNVP->m_strValue += "\\";
		#else
				pNVP->m_strValue += "/";
		#endif
			}
			return pNVP->m_strValue;
		}
		else if (bThrowNotFound)
		{
			// throw key not found

		}
	}
	else if (bThrowNotFound)
	{
		// throw key not found

	}

	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:32,代码来源:GProfile.cpp


示例10: FindKey

string CIniFile::ValueName( string const keyname, unsigned const valueID) const
{
  long keyID = FindKey( keyname);
  if ( keyID == noID)
    return "";
  return ValueName( keyID, valueID);
}
开发者ID:stephen-hill,项目名称:musicCube,代码行数:7,代码来源:iniFile.cpp


示例11: getter_AddRefs

void nsMsgXFVirtualFolderDBView::UpdateCacheAndViewForFolder(nsIMsgFolder *folder, nsMsgKey *newHits, PRUint32 numNewHits)
{
  nsCOMPtr <nsIMsgDatabase> db;
  nsresult rv = folder->GetMsgDatabase(nsnull, getter_AddRefs(db));
  if (NS_SUCCEEDED(rv) && db)
  {
    nsCString searchUri;
    m_viewFolder->GetURI(searchUri);
    PRUint32 numBadHits;
    nsMsgKey *badHits;
    rv = db->RefreshCache(searchUri.get(), numNewHits, newHits,
                     &numBadHits, &badHits);
    if (NS_SUCCEEDED(rv))
    {
      for (PRUint32 badHitIndex = 0; badHitIndex < numBadHits; badHitIndex++)
      {
        // of course, this isn't quite right
        nsMsgViewIndex staleHitIndex = FindKey(badHits[badHitIndex], PR_TRUE);
        if (staleHitIndex != nsMsgViewIndex_None)
          RemoveByIndex(staleHitIndex);
      }
      delete [] badHits;
    }
  }
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:25,代码来源:nsMsgXFVirtualFolderDBView.cpp


示例12: main

int main()
{
    HashTable H;
    H = initializeTable(353);

    int i;
    int key;
    Position P;
    ////insertKey(1,H);
    //insertKey(2,H);
    //insertKey(3,H);

    ////deleteKey(1,H);
    //deleteKey(2,H);
    //deleteKey(3,H);

    for(i=0; i<100; i++)
    {
        key = i;
        insertKey(key, H);
    }
    //deleteKey(100, H);
    //for(i=99; i>=0; i--)
    //	deleteKey(i, H);

    P = FindKey(6,H);
    printf("Index %d is found\n",P);

    PrintHashTable(H);
    DestroyTable(H);
    std::cout<<std::endl;
}
开发者ID:YinWenAtBIT,项目名称:Data-Structure,代码行数:32,代码来源:test.cpp


示例13: assert

/*
================
idDict::Delete
================
*/
void idDict::Delete( const char *key )
{
    int hash, i;

    hash = argHash.GenerateKey( key, false );
    for ( i = argHash.First( hash ); i != -1; i = argHash.Next( i ) )
    {
        if ( args[i].GetKey().Icmp( key ) == 0 )
        {
            globalKeys.FreeString( args[i].key );
            globalValues.FreeString( args[i].value );
            args.RemoveIndex( i );
            argHash.RemoveIndex( hash, i );
            break;
        }
    }

#if 0
    // make sure all keys can still be found in the hash index
    for ( i = 0; i < args.Num(); i++ )
    {
        assert( FindKey( args[i].GetKey() ) != NULL );
    }
#endif
}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:30,代码来源:Dict.cpp


示例14: IsStored

	// wowOptions нужен только для HKLM
	RegKeyType IsStored(HKEY hKey, DWORD wowOptions=0 /*KEY_WOW64_64KEY/KEY_WOW64_32KEY*/)
	{
		RegKeyInfo* p;
		if (hKey && (p = FindKey(hKey, wowOptions)))
			return p->rkt;
		return RKT_None;
	};
开发者ID:EricSB,项目名称:ConEmu,代码行数:8,代码来源:RegHooks.cpp


示例15: FindKey

VariableDATA *Array::ModuleGet(const char *key) {
    ARRAY_COUNT_TYPE i = -1;

    i = FindKey(key);

    if (i == -1) {
        AnsiString tmp(key);
        AddKey(&tmp, COUNT);
        ADD_VARIABLE(0, PIF);
    }

    if (i < COUNT) {
        ARRAY_COUNT_TYPE target_node = i / ARRAY_INCREMENT;
        ARRAY_COUNT_TYPE d_count     = i % ARRAY_INCREMENT;
        NODE *CURRENT = FIRST;
        for (ARRAY_COUNT_TYPE k = 0; k < target_node; k++) {
            CURRENT = CURRENT->NEXT;
        }
        ENSURE_ELEMENTS(CURRENT, d_count);
        ArrayElement *ELEMENTS = CURRENT->ELEMENTS;
        if (!ELEMENTS [d_count]) {
            CREATE_VARIABLE(ELEMENTS [d_count], PIF);
        }
        return ELEMENTS [d_count];
    }
    ARRAY_COUNT_TYPE target = i;
    while (COUNT < target) {
        ADD_MULTIPLE_VARIABLE2;
    }
    ADD_VARIABLE(0, PIF);
    return 0;
}
开发者ID:Devronium,项目名称:ConceptApplicationServer,代码行数:32,代码来源:Array.cpp


示例16: assert

CString Environment::GetEnv(const TCHAR* key) const
{
	assert(key);

	std::pair<size_t, size_t> keyPos = FindKey(m_env, key);
	return GetValue(&(m_env[keyPos.first]));
}
开发者ID:murank,项目名称:TortoiseGitMod,代码行数:7,代码来源:Environment.cpp


示例17: Construct

void Construct(const char* bin_name)
{
        FILE *input=fopen(TMP_OUT, "r");
        NODE *pointer, *tp;
        uint32 key;

        if(!input){
                fprintf(stderr, "%s: Cannot open " TMP_OUT ".\n", bin_name);
                exit(1);
        }
        InitConstruct();
        
        while ( 1 ) {   
                fscanf( input, "%lu", &key );
                if ( feof( input ) ) break;
                pointer = root;
                /* for each key in a keyin sequence */
                for ( ; key != 0; fscanf( input, "%lu", &key ) ) {      
                        if ( ( tp = FindKey( pointer, key ) ) ) {
                                pointer = tp;
                        }
                        else {
                                tp = Insert( pointer, key );
                                pointer = tp;
                        }
                }
                pointer->phraseno = keyin_count++;
        }
}
开发者ID:school510587,项目名称:libchewing-old,代码行数:29,代码来源:maketree.c


示例18: FindKey

void *KeyValues::GetPtr(const char *keyName, void *defaultValue)
{
	KeyValues *dat = FindKey(keyName, false);

	if (dat)
	{
		switch (dat->m_iDataType)
		{
			case TYPE_PTR:
			{
				return dat->m_pValue;
			}

			case TYPE_WSTRING:
			case TYPE_STRING:
			case TYPE_FLOAT:
			case TYPE_INT:
			case TYPE_UINT64:
			default:
			{
				return NULL;
			}
		}
	}

	return defaultValue;
}
开发者ID:hzqst,项目名称:CaptionMod,代码行数:27,代码来源:KeyValues.cpp



注:本文中的FindKey函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindModule函数代码示例发布时间:2022-05-30
下一篇:
C++ FindItem函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap