这篇教程C++ FindName函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FindName函数的典型用法代码示例。如果您正苦于以下问题:C++ FindName函数的具体用法?C++ FindName怎么用?C++ FindName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FindName函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: doRvalstruct ExprRes * doRval(char * name) { struct ExprRes *res; struct SymEntry * e; if( global ){ e = FindName(locTable, name); if( !e) { e = FindName(table, name); } } else { e = FindName(table, name); } if (!e) { WriteIndicator(GetCurrentColumn()); WriteMessage("Undeclared variable"); exit(1); //doing something stupid like "print ln;" will cause me to segfault if we don't quit } struct Vtype * vtype = ((struct Vtype *)e->Attributes); res = (struct ExprRes *) malloc(sizeof(struct ExprRes)); res->Reg = AvailTmpReg(); if ( vtype->Local == 0 ){ res->Instrs = GenInstr(NULL,"lw",TmpRegName(res->Reg),name,NULL); } else { res->Instrs = GenInstr(NULL, "lw", TmpRegName(res->Reg), RegOff(vtype->StackIndex, "$sp"), NULL); } res->Type = vtype->Type; return res;}
开发者ID:tyman7,项目名称:compiler,代码行数:34,
示例2: memsetvoid FName::NameManager::InitBuckets (){ Inited = true; memset (Buckets, -1, sizeof(Buckets)); // Register built-in names. 'None' must be name 0. for (size_t i = 0; i < countof(PredefinedNames); ++i) { assert((0 == FindName(PredefinedNames[i], true)) && "Predefined name already inserted"); FindName (PredefinedNames[i], false); }}
开发者ID:Edward850,项目名称:zdoom,代码行数:12,
示例3: doArrayAssignstruct InstrSeq * doArrayAssign( char * name, struct ExprRes * index, struct ExprRes * val){ struct SymEntry *e; if( global ){ e = FindName(locTable, name); if( !e){ e = FindName(table, name); } } else{ e = FindName(table, name); } struct Vtype * vtype = ((struct Vtype *)e->Attributes); struct InstrSeq * code; int reg = AvailTmpReg(); char * buffer; if (!e){ WriteIndicator(GetCurrentColumn()); WriteMessage("Undeclared variable"); } if(index->Type != TYPE_INT){ TypeError(); } else if( val->Type != -1 && ((vtype->Type == TYPE_BOOLARR && val->Type != TYPE_BOOL) || (vtype->Type == TYPE_INTARR && val->Type != TYPE_INT ))){ TypeError(); } buffer = RegOff(0, TmpRegName(reg)); code = val->Instrs; AppendSeq(code, index->Instrs); // change for locality later if (! vtype->Local){ AppendSeq( code, GenInstr( NULL, "la", TmpRegName(reg), name, NULL)); } else { AppendSeq(code, GenInstr(NULL, "addi", TmpRegName(reg), "$sp", Imm(vtype->StackIndex))); } AppendSeq( code, GenInstr( NULL, "mul", TmpRegName(index->Reg), TmpRegName(index->Reg), "4")); AppendSeq( code, GenInstr(NULL, "add", TmpRegName(reg), TmpRegName(reg), TmpRegName(index->Reg))); AppendSeq( code, GenInstr(NULL, "sw", TmpRegName(val->Reg), buffer, NULL)); ReleaseTmpReg(val->Reg); ReleaseTmpReg(index->Reg); ReleaseTmpReg(reg); free(val); free(index); return code; }
开发者ID:tyman7,项目名称:compiler,代码行数:51,
示例4: DbgLogMediaTypeInfovoid DbgLogMediaTypeInfo(DWORD type, DWORD level, const CMediaType* pmt){ DbgLogInfo(type, level, TEXT(" MediaType Info : %s %s %s %s SampleSize=%ld"), FindName(g_MediaTypes, &pmt->majortype), FindName(g_MediaSubTypes, &pmt->subtype), (pmt->bFixedSizeSamples ? TEXT("FixedSamples") : TEXT("NotFixedSamples")), (pmt->bTemporalCompression ? TEXT("TemporalCompression") : TEXT("NotTemporalCompression")), pmt->lSampleSize);}
开发者ID:Harurow,项目名称:DSFilters,代码行数:14,
示例5: FindNameCSrResourceFolder* CSrResourceHandler::GetScriptsFolder (void){ CSrResourceBase* pBasePath = FindName("scripts//source//"); if (pBasePath == NULL || !pBasePath->IsFolder()) return NULL; return (CSrResourceFolder *) pBasePath;}
开发者ID:Purr4me,项目名称:TES5Edit-GoogleCode,代码行数:7,
示例6: GetNameHRESULT GetName(const NamedGuid* pTable, LPTSTR pszString, int cchBuf, const GUID *pGuid){ ASSERT(pTable); ASSERT(pszString); ASSERT(pGuid); if (cchBuf < 1) { return E_INVALIDARG; } HRESULT hr = E_FAIL; pszString[0] = TEXT('/0'); const LPCTSTR pName = FindName(pTable, pGuid); if (pName) { if (_tcscpy_s(pszString, cchBuf, pName) == 0) { return S_OK; } } if (FAILED(hr)) { hr = StringFromGUID2(*pGuid, pszString, cchBuf); } return hr;}
开发者ID:Harurow,项目名称:DSFilters,代码行数:28,
示例7: static struct NamedObj *searchns(pUtility UtilBase, struct NamedObj *object, struct NameSpace *ns, STRPTR search){ struct NamedObj *ret; if (!search) { if (object->no_Non.non_Node.ln_Succ) return object; return NULL; } if ((ns->ns_Flags & NSB_CASE) != 0) { ret = (struct NamedObj *)FindName((struct List *)object->no_Non.non_Node.ln_Pred, search); return ret; } ForeachNode(object, ret) { if (Stricmp((const char*)search, (const char*)ret->no_Non.non_Node.ln_Name) == 0) { if (ret->no_Non.non_Node.ln_Succ) return ret; return NULL; } } return NULL;}
开发者ID:cycl0ne,项目名称:poweros_x86,代码行数:25,
示例8: time_of_find_namedouble time_of_find_name(char *Last){ struct timespec t_start, t_end; uint64_t nsec1 = 0; uint64_t nsec2 = 0; uint64_t elapsed_nsec = 0; PhoneBook *pb_found; clock_gettime(CLOCK_MONOTONIC, &t_start); nsec1 = ((uint64_t)(t_start.tv_sec) * 1000000000LL + t_start.tv_nsec); pb_found = FindName(Last, pb); clock_gettime(CLOCK_MONOTONIC, &t_end); nsec2 = (uint64_t)(t_end.tv_sec) * 1000000000LL + t_end.tv_nsec; elapsed_nsec = nsec2 - nsec1; if(pb_found != NULL) { printf("%s found ",Last); } else printf("%s not found/n",Last); //printf("used time :%.3f sec/n",(double)elapsed_nsec/1000000000.0); return (double)elapsed_nsec/1000000000.0;}
开发者ID:musicguitar,项目名称:phonebook_opt,代码行数:29,
示例9: mainint main(void){ PhoneBook *pb[DATA]; int i = 0; clock_t start_time, end_time; pb[i] = (PhoneBook*) malloc(sizeof(PhoneBook)); strncpy(pb[i]->LastName, "aaa", sizeof("aaa")); // strncpy(pb[i]->LastName, "pjay", sizeof("pjay")); while (i++ < DATA) { pb[i] = (PhoneBook*) malloc(sizeof(PhoneBook)); strncpy(pb[i]->LastName, "aaa", sizeof("aaa")); pb[i-1]->pNext = pb[i]; } strncpy(pb[DATA - 1]->LastName, "pjay", sizeof("pjay")); printf("%ld Byte * %d = %ld KByte/n", sizeof(PhoneBook), DATA, (sizeof(PhoneBook) * DATA)/1024); start_time = clock(); PhoneBook *getPb = FindName("pjay", pb[0]); end_time = clock(); printf("%f microsec/n", (float)(end_time - start_time)); if (getPb != NULL) { printf("%s/n", getPb->LastName); } return 0;}
开发者ID:PJayChen,项目名称:Optimizing-Program-Example,代码行数:31,
示例10: L_WB_PutDiskObject// Patched PutDiskObject()BOOL __asm __saveds L_WB_PutDiskObject( register __a0 char *name, register __a1 struct DiskObject *diskobj){ struct LibData *data; struct MyLibrary *libbase; BOOL result,magic=0; // Get library if (!(libbase=(struct MyLibrary *)FindName(&((struct ExecBase *)*((ULONG *)4))->LibList,"dopus5.library"))) return 0; // Get data pointer data=(struct LibData *)libbase->ml_UserData; // See if icon type is set to inverse magic if (diskobj->do_Magic==(USHORT)~WB_DISKMAGIC) { // Fix it diskobj->do_Magic=WB_DISKMAGIC; // Set magic flag, which will stop us sending notification magic=1; } // Write icon result=L_WriteIcon(name,diskobj,libbase); // Succeeded? if (result && !magic) icon_notify(data,name,0,0); return result;}
开发者ID:MrZammler,项目名称:opus_magellan,代码行数:34,
示例11: L_WB_DeleteDiskObject// Patched DeleteDiskObject()BOOL __asm __saveds L_WB_DeleteDiskObject(register __a0 char *name){ struct LibData *data; struct MyLibrary *libbase; BOOL result; char *full_name; // Get library if (!(libbase=(struct MyLibrary *)FindName(&((struct ExecBase *)*((ULONG *)4))->LibList,"dopus5.library"))) return 0; // Get data pointer data=(struct LibData *)libbase->ml_UserData; // Get full name full_name=icon_fullname(data,name); // Write icon result=L_DeleteIcon(name,libbase);#define DOSBase (data->dos_base) // Succeeded? if ((result || IoErr()==ERROR_OBJECT_NOT_FOUND) && full_name) icon_notify(data,full_name,INF_FULLNAME,1);#undef DOSBase // Free full name buffer FreeVec(full_name); return result;}
开发者ID:MrZammler,项目名称:opus_magellan,代码行数:33,
示例12: column/** @param type :: Data type of the column. @param name :: Column name. @return A shared pointer to the created column (will be null on failure).*/API::Column_sptr TableWorkspace::addColumn(const std::string &type, const std::string &name) { API::Column_sptr c; if (type.empty()) { g_log.error("Empty string passed as type argument of createColumn."); return c; } if (name.empty()) { g_log.error("Empty string passed as name argument of createColumn."); return c; } // Check that there is no column with the same name. auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name)); if (ci != m_columns.end()) { g_log.error() << "Column with name " << name << " already exists./n"; return c; } try { c = API::ColumnFactory::Instance().create(type); m_columns.push_back(c); c->setName(name); resizeColumn(c.get(), rowCount()); } catch (Kernel::Exception::NotFoundError &e) { g_log.error() << "Column of type " << type << " and name " << name << " has not been created./n"; g_log.error() << e.what() << '/n'; return c; } return c;}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:34,
示例13: mainint main(){ int n; int index; int edges; int first, second; int counter; char tmp[MAX_LENGTH]; double tr; counter = 0; do { counter++; scanf("%d", &n); if(!n) break; for(index=1; index<=n; index++) scanf("%s", names[index]); scanf("%d",&index); for(edges=0; edges<index; edges++) { scanf("%s", tmp); eArr[edges].x = FindName(tmp, n); scanf("%lf", &eArr[edges].rate); scanf("%s", tmp); eArr[edges].y = FindName(tmp, n); }#if DEBUG ShowEdges(edges);#endif printf("Case %d: ", counter); if(Bellman_Ford(edges) < 0) printf("Yes/n"); else printf("No/n"); }while(1); return 0;}
开发者ID:UsuallyGO,项目名称:POJ,代码行数:45,
示例14: FindName/// Gets the shared pointer to a column.API::Column_sptr TableWorkspace::getColumn(const std::string &name) { auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name)); if (ci == m_columns.end()) { std::string str = "Column " + name + " does not exist./n"; g_log.error(str); throw std::runtime_error(str); } return *ci;}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:10,
示例15: Dsem_t *sem_open(const char *name, int oflag, mode_t mode, unsigned int value){ sem_t *sem; D(bug("%s(%s, %d, %u, %u)/n", __FUNCTION__, name, oflag, mode, value)); pthread_once(&once_control, _Init_Semaphore); if (name == NULL) { errno = EINVAL; return SEM_FAILED; } ObtainSemaphore(&sema_sem); sem = (sem_t *)FindName(&semaphores, (STRPTR)name); if (sem != NULL) { if ((oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) { ReleaseSemaphore(&sema_sem); errno = EEXIST; return SEM_FAILED; } } else { if (!(oflag & O_CREAT)) { ReleaseSemaphore(&sema_sem); errno = ENOENT; return SEM_FAILED; } sem = malloc(sizeof(sem_t)); if (sem == NULL) { ReleaseSemaphore(&sema_sem); errno = ENOMEM; return SEM_FAILED; } if (sem_init(sem, 0, value)) { free(sem); ReleaseSemaphore(&sema_sem); return SEM_FAILED; } // TODO: this string should be duplicated sem->node.ln_Name = (char *)name; AddTail(&semaphores, (struct Node *)sem); } ReleaseSemaphore(&sema_sem); return sem;}
开发者ID:michalsc,项目名称:AROS,代码行数:56,
示例16: NewAFilestatic AFile* NewAFile (IFile* IF, FILE* F)/* Create a new AFile, push it onto the stack, add the path of the file to * the path search list, and finally return a pointer to the new AFile struct. */{ StrBuf Path = AUTO_STRBUF_INITIALIZER; /* Allocate a AFile structure */ AFile* AF = (AFile*) xmalloc (sizeof (AFile)); /* Initialize the fields */ AF->Line = 0; AF->F = F; AF->Input = IF; /* Increment the usage counter of the corresponding IFile. If this * is the first use, set the file data and output debug info if * requested. */ if (IF->Usage++ == 0) { /* Get file size and modification time. There a race condition here, * since we cannot use fileno() (non standard identifier in standard * header file), and therefore not fstat. When using stat with the * file name, there's a risk that the file was deleted and recreated * while it was open. Since mtime and size are only used to check * if a file has changed in the debugger, we will ignore this problem * here. */ struct stat Buf; if (FileStat (IF->Name, &Buf) != 0) { /* Error */ Fatal ("Cannot stat `%s': %s", IF->Name, strerror (errno)); } IF->Size = (unsigned long) Buf.st_size; IF->MTime = (unsigned long) Buf.st_mtime; /* Set the debug data */ g_fileinfo (IF->Name, IF->Size, IF->MTime); } /* Insert the new structure into the AFile collection */ CollAppend (&AFiles, AF); /* Get the path of this file and add it as an extra search path. * To avoid file search overhead, we will add one path only once. * This is checked by the PushSearchPath function. */ SB_CopyBuf (&Path, IF->Name, FindName (IF->Name) - IF->Name); SB_Terminate (&Path); AF->SearchPath = PushSearchPath (UsrIncSearchPath, SB_GetConstBuf (&Path)); SB_Done (&Path); /* Return the new struct */ return AF;}
开发者ID:eakmeister,项目名称:cc65,代码行数:56,
示例17: GetModulestatic unsigned GetModule (const char* Name)/* Get a module name index from the file name */{ /* Make a module name from the file name */ const char* Module = FindName (Name); if (*Module == 0) { Error ("Cannot make module name from `%s'", Name); } return GetStringId (Module);}
开发者ID:gilligan,项目名称:snesdev,代码行数:10,
示例18: Addbool c_CustomRendererVector::Add( c_CustomRenderer* DataLayer ){ if( FindName(DataLayer->m_Name.c_str()) ) { return false; } m_CustomRendererVector.push_back(DataLayer); return true;}
开发者ID:Victorcasas,项目名称:georest,代码行数:10,
示例19: FindNamebool csArchive::FileExists (const char *name, size_t *size) const{ ArchiveEntry *f = (ArchiveEntry *) FindName (name); if (!f) return false; if (size) *size = f->info.ucsize; return true;}
开发者ID:BackupTheBerlios,项目名称:libjtv-svn,代码行数:10,
示例20: assert/*Returns true if found an appropriate name in the DB for chr, or false if it did not found such name. Also changes nameChanged if the name was found but changed since the last time we've called CheckName function */bool CPokerTrackerThread::CheckName(int chr, bool &nameChanged){ char oh_scraped_name[k_max_length_of_playername]; char best_name[k_max_length_of_playername]; bool result = false, ok_scrape = false; int i; assert(chr >= k_min_chair_number); assert(chr <= k_max_chair_number); memset(oh_scraped_name, 0, k_max_length_of_playername); memset(best_name, 0, k_max_length_of_playername); nameChanged = false; if (p_game_state->state((p_game_state->state_index()-1)&0xff)->m_player[chr].m_name_known == 0) return false; strcpy_s(oh_scraped_name, k_max_length_of_playername, p_game_state->state((p_game_state->state_index()-1)&0xff)->m_player[chr].m_name); // Check for bad name scrape int len = (int) strlen(oh_scraped_name); for (i = 0; i < len; ++i) { if (oh_scraped_name[i]!='l' && oh_scraped_name[i]!='i' && oh_scraped_name[i]!='.' && oh_scraped_name[i]!=',') { ok_scrape = true; break; } } if (!ok_scrape) return false; // We already have the name, and it has not changed since we last checked, so do nothing if (_player_stats[chr].found && 0 == strcmp(_player_stats[chr].scraped_name, oh_scraped_name)) return true; nameChanged = true; // We have not found the name in PT, go find it // First see if we can find the exact scraped name result = FindName(oh_scraped_name, best_name); if (result) { SetPlayerName(chr, true, best_name, oh_scraped_name); } else { SetPlayerName(chr, false, "", ""); } return result;}
开发者ID:ohzooboy,项目名称:oh,代码行数:58,
示例21: memsetvoid FName::NameManager::InitBuckets (){ Inited = true; memset (Buckets, -1, sizeof(Buckets)); // Register built-in names. 'None' must be name 0. for (size_t i = 0; i < countof(PredefinedNames); ++i) { FindName (PredefinedNames[i], false); }}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:11,
示例22: FindNameCDotNetClass* CDotNetClass::GetObject(string name){ size_t nIndex = FindName(name); if (nIndex == -1) return nullptr; CDotNetField* pField = m_arFieldValues[nIndex]; CUserClassField* pValue = dynamic_cast<CUserClassField*>(pField); if (pValue == nullptr) return nullptr; return pValue->GetClassObject();}
开发者ID:maztheman,项目名称:DotNetSerializer-cpp,代码行数:11,
示例23: AddName int AddName(char *nm) { int ret; int olen; if ((ret = FindName(nm)) > 0) return ret; olen = length; strcpy_s(&nametext[length], sizeof(nametext)-length, nm); length += strlen(nm) + 1; return olen; };
开发者ID:robfinch,项目名称:Cores,代码行数:11,
示例24: ChkObj// get info about a specific obj. if not found, returns an error code.int ChkObj( char *name, attr_t *attr_p ) { dir_t *dir_p = FindName( name ); if( ! dir_p ) return UNFOUND; Dir2Attr( dir_p, attr_p ); // copy what dir_p points to to where attr_p points to// this should be included to pass the filename (add 1 to length for null) MyMemcpy( (char *)( attr_p + 1 ), dir_p->name, MyStrlen( dir_p->name ) + 1 ); return GOOD;}
开发者ID:acbueff,项目名称:MAARKos,代码行数:13,
示例25: assert/* Returns true if found an appropriate name in the DB for chr, or false if it did not found such name.*/bool CPokerTrackerThread::CheckIfNameExistsInDB(int chair){ char oh_scraped_name[kMaxLengthOfPlayername]; char best_name[kMaxLengthOfPlayername]; assert(chair >= kFirstChair); assert(chair <= kLastChair); memset(oh_scraped_name, 0, kMaxLengthOfPlayername); memset(best_name, 0, kMaxLengthOfPlayername); write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() chair = %i/n", chair); if (LAST_STATE.m_player[chair].m_name_known == 0) { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() No name known for this chair/n"); return false; } if (strlen(LAST_STATE.m_player[chair].m_name) <= kMaxLengthOfPlayername) { strcpy_s(oh_scraped_name, kMaxLengthOfPlayername, LAST_STATE.m_player[chair].m_name); } write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Scraped name: [%s]/n", oh_scraped_name); if (NameLooksLikeBadScrape(oh_scraped_name)) { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Name looks like a bad scrape/n"); return false; } // We already have the name, and it has not changed since we last checked, so do nothing if (_player_data[chair].found && 0 == strcmp(_player_data[chair].scraped_name, oh_scraped_name)) { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Name is known and good/n"); return true; } // We have not found the name in PT, go find it // First see if we can find the exact scraped name if (FindName(oh_scraped_name, best_name)) { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Name found in database/n"); SetPlayerName(chair, true, best_name, oh_scraped_name); return true; } else { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Name not found in database/n"); SetPlayerName(chair, false, "", ""); return false; }}
开发者ID:alekseyf,项目名称:openholdembot-1,代码行数:54,
示例26: switchchar *GTIFValueName(geokey_t key, int value){ KeyInfo *info; switch (key) { /* All codes using linear/angular/whatever units */ case GeogLinearUnitsGeoKey: case ProjLinearUnitsGeoKey: case GeogAngularUnitsGeoKey: case GeogAzimuthUnitsGeoKey: info=_geounitsValue; break; /* put other key-dependent lists here */ case GTModelTypeGeoKey: info=_modeltypeValue; break; case GTRasterTypeGeoKey: info=_rastertypeValue; break; case GeographicTypeGeoKey: info=_geographicValue; break; case GeogGeodeticDatumGeoKey: info=_geodeticdatumValue; break; case GeogEllipsoidGeoKey: info=_ellipsoidValue; break; case GeogPrimeMeridianGeoKey: info=_primemeridianValue; break; case ProjectedCSTypeGeoKey: info=_pcstypeValue; break; case ProjectionGeoKey: info=_projectionValue; break; case ProjCoordTransGeoKey: info=_coordtransValue; break; case VerticalCSTypeGeoKey: info=_vertcstypeValue; break; case VerticalDatumGeoKey: info=_vdatumValue; break; /* And if all else fails... */ default: info = _csdefaultValue;break; } return FindName( info,value);}
开发者ID:hkaiser,项目名称:TRiAS,代码行数:32,
注:本文中的FindName函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FindNext函数代码示例 C++ FindModule函数代码示例 |