当前位置: 首页>>代码示例>>C++>>正文


C++ FindKey函数代码示例

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


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


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