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


C++ First函数代码示例

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


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

示例1: First

// compte les points sur le polygone convexe  //the points on the convex polygon
int DocRecord::CountPointsOnHull()
{
	PointNumero p, p2, temp;
	int i, n=numPoints;

	if(points[0].adjacent == NULL)
		return 0;
	i = 1;
	p = 0;
	p2 = First(0);
	while((p2 != 0) && (i < n)) {
		i++;
		temp = p2;
		p2 = Successor(p2, p);
		p = temp;
	}
	return (i <= n) ? i : -1;
}
开发者ID:joilee,项目名称:ioNas,代码行数:19,代码来源:DivideAndConquer.cpp

示例2: First

Track *TrackListIterator::StartWith(Track * val)
{
   if (val == NULL) {
      return First();
   }

   if (l == NULL) {
      return NULL;
   }

   cur = (TrackListNode *) val->GetNode();

   if (cur) {
      return cur->t;
   }

   return NULL;
}
开发者ID:bhaveekdesai,项目名称:audacity,代码行数:18,代码来源:Track.cpp

示例3: SwigType_parmlist

/* Create a list of parameters from the type t, using the file_line_node Node for 
 * file and line numbering for the parameters */
ParmList *SwigType_function_parms(const SwigType *t, Node *file_line_node) {
  List *l = SwigType_parmlist(t);
  Hash *p, *pp = 0, *firstp = 0;
  Iterator o;

  for (o = First(l); o.item; o = Next(o)) {
    p = file_line_node ? NewParm(o.item, 0, file_line_node) : NewParmWithoutFileLineInfo(o.item, 0);
    if (!firstp)
      firstp = p;
    if (pp) {
      set_nextSibling(pp, p);
      Delete(p);
    }
    pp = p;
  }
  Delete(l);
  return firstp;
}
开发者ID:kingpotato,项目名称:swig,代码行数:20,代码来源:typeobj.c

示例4: cChannelSorter

void cChannels::DeleteDuplicateChannels(void)
{
  cList<cChannelSorter> ChannelSorter;
  for (cChannel *channel = First(); channel; channel = Next(channel)) {
      if (!channel->GroupSep())
         ChannelSorter.Add(new cChannelSorter(channel));
      }
  ChannelSorter.Sort();
  cChannelSorter *cs = ChannelSorter.First();
  while (cs) {
        cChannelSorter *next = ChannelSorter.Next(cs);
        if (next && cs->channelID == next->channelID) {
           dsyslog("deleting duplicate channel %s", *next->channel->ToText());
           Del(next->channel);
           }
        cs = next;
        }
}
开发者ID:FFTEAM,项目名称:evolux-spark-sh4,代码行数:18,代码来源:channels.c

示例5: DS_Debug_Printf1

OP_STATUS DataStream_SequenceBase::ReadRecordSequenceFromStreamL(DataStream *src, DataStream *last_element)
{
	OP_STATUS op_err;

	DS_Debug_Printf1("DataStream_SequenceBase::ReadStructureRecordsFromStreamL: Step %u Starting to process structure\n", step);

	if(current_item == NULL)
	{
		step = 0;
		ReadActionL(step++, DataStream_SequenceBase::STRUCTURE_START);
		current_item = First();
	}
	
	while(current_item)
	{
		if(current_item->GetEnabledRecord())
		{
			op_err = current_item->ReadRecordFromStreamL(GetInputSource(src));
			if(op_err == OpRecStatus::OK || op_err == OpRecStatus::WAIT_FOR_DATA)
				return op_err;
			else if(op_err != OpRecStatus::FINISHED)
			{
					DS_LEAVE(OpRecStatus::IsError(op_err) ? op_err : OpRecStatus::RECORD_TOO_SHORT);
			}
			DS_Debug_Printf1("DataStream_SequenceBase::ReadStructureRecordsFromStreamL:  Step %u read item\n", step);
		}
		else
		{
			DS_Debug_Printf1("DataStream_SequenceBase::ReadStructureRecordsFromStreamL:  Step %u bypassed disabled entry\n", step);
		}

		ReadActionL(step++, current_item->GetItemID());

		BOOL is_last_element = (current_item == last_element ? TRUE : FALSE);

		current_item = current_item->Suc();

		if(current_item && is_last_element)
			return OpRecStatus::FINISHED;
	}
	ReadActionL(step, DataStream_SequenceBase::STRUCTURE_FINISHED);

	return OpRecStatus::FINISHED;
}
开发者ID:prestocore,项目名称:browser,代码行数:44,代码来源:fl_list.cpp

示例6: SwigType_typedef_resolve_all

SwigType *SwigType_default_create(const SwigType *ty) {
  SwigType *r = 0;
  List *l;
  Iterator it;
  int numitems;

  if (!SwigType_isvarargs(ty)) {
    SwigType *t = SwigType_typedef_resolve_all(ty);
    r = NewStringEmpty();
    l = SwigType_split(t);
    numitems = Len(l);

    if (numitems >= 1) {
      String *last_subtype = Getitem(l, numitems-1);
      if (SwigType_isenum(last_subtype))
	Setitem(l, numitems-1, NewString("enum SWIGTYPE"));
      else
	Setitem(l, numitems-1, NewString("SWIGTYPE"));
    }

    for (it = First(l); it.item; it = Next(it)) {
      String *subtype = it.item;
      if (SwigType_isarray(subtype)) {
	if (Equal(subtype, "a()."))
	  Append(r, NewString("a()."));
	else
	  Append(r, NewString("a(ANY)."));
      } else if (SwigType_isfunction(subtype)) {
	Append(r, NewString("f(ANY).SWIGTYPE"));
	break;
      } else if (SwigType_ismemberpointer(subtype)) {
	Append(r, NewString("m(CLASS).SWIGTYPE"));
	break;
      } else {
	Append(r, subtype);
      }
    }

    Delete(l);
    Delete(t);
  }

  return r;
}
开发者ID:Distrotech,项目名称:swig,代码行数:44,代码来源:stype.c

示例7: OpenSeq

void OpenSeq(TSequencer * s, char * n)
{
        midiFILE *      f;
        int             i;
        
 // initialisation
 
 	s->ref = MidiOpen("msMidiPlayer");
        s->state = idle;
        s->seq = MidiNewSeq();
        s->playtask = 0;
	s->looptask = 0;
		
        
 // read the midi file
        
        f = MidiFileOpen(n, MidiFileRead);
		
        if (!f) {
                printf ("Error opening MidiFile %s (%d)\n", n, MidiFile_errno);
                CloseSeq(s);
                exit(MidiFile_errno);
        }
        for (i = f->ntrks; i; i--){ MixSeq( MidiFileReadTrack(f), s->seq); }
	           
        if (smpte(f)) 
                TrsfSmpteSeq(s->seq, frame_par_sec(f), ticks_par_frame(f));
        else
                TrsfTempoSeq(s->seq, ticks_par_quarterNote(f));
	
	if (First(s->seq))
	 	printf("File : %s, Format : %d, Tracks : %d, Length : %d, Duration : %d\n",
                        n, f->format, f->ntrks, LenSeq(s->seq), Date(Last(s->seq)) );
	           
        (void) MidiFileClose(f);
       
 // installation
    	
        MidiSetInfo(s->ref, s);
        MidiSetRcvAlarm(s->ref, NullRcv);
        
        MidiConnect(s->ref, 0, 1);
        MidiConnect(0, s->ref, 1);
}
开发者ID:informatimago,项目名称:midishare,代码行数:44,代码来源:msMidiPlayer.c

示例8: First

void scStream::STRCopy( scStream*& dst ) const
{
	scContUnit* srcPara = First();
	scContUnit* dstPara;

	try {
		dst 	= 0;
		dstPara = 0;
		for ( ; srcPara; srcPara = srcPara->GetNext( ) ) {
			dstPara = srcPara->Copy( dstPara );
			if ( dst == NULL )
				dst = dstPara->GetStream();
		}
	} catch( ... ) {
		if ( dst )
			dst->STRFree(), dst = 0;
		throw;
	} 
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:19,代码来源:scstream.cpp

示例9: TestFindRecursively

void TestFindRecursively() {
	// make list 1
	List l1 = NULL;
	l1 = MakeArrayStackEmpty(l1);
	Position curl1 = l1;
	for (int i = 0; i < 30000; ++i) {
		curl1 = Insert(i * 3, l1, curl1);
	}
	time_t stime, etime;
	stime = clock();
	Position re = FindRecursively(87300, First(l1));
	etime = clock();

	printf("recursively %d, runtime: %d\n", re->Element, etime - stime);
	stime = clock();
	Position re1 = Find(87300, l1);
	etime = clock();
	printf("normally %d, runtime: %d\n", re1->Element, etime - stime);
}
开发者ID:wanghan,项目名称:my_code,代码行数:19,代码来源:exercise.c

示例10: GetNextIFrame

	virtual int GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber = NULL, off_t *FileOffset = NULL, int *Length = NULL) {
		cMutexLock lock(&idx_lock);
		std::vector<tLiveIndex>::iterator item = GetIndex(Index);
		if(item == idx.end()) {
			if(Index < First() && Forward)
				item = idx.begin();
			else
				return -1;
		}
		if(Forward) {
			do {
				item++;
				if(item == idx.end()) return -1;
			} while(!item->independent);
		} else {
			do {
				if(item == idx.begin()) return -1;
				item--;
			} while(!item->independent);
		} // if
		uint16_t fn;
		if (!FileNumber)
			FileNumber = &fn;
		off_t fo;
		if (!FileOffset)
			FileOffset = &fo;
		*FileNumber = item->number;
		*FileOffset = item->offset;
		item++;
		if(item == idx.end()) return -1;
		if (Length) {
			// all recordings end with a non-independent frame, so the following should be safe:
			uint16_t fn = item->number;
			off_t fo = item->offset;
			if (fn == *FileNumber) {
				*Length = int(fo - *FileOffset);
			} else {
				esyslog("ERROR: 'I' frame at end of file #%d", *FileNumber);
				*Length = -1;
			} // if
		} // if
		return Index;
	}; // GetNextIFrame
开发者ID:suborb,项目名称:reelvdr,代码行数:43,代码来源:livebuffer.c

示例11: First

// rename a file from oldArkFilename to newArkFilename
// you can cahnge the full filepath not just the filename using this
// 
// args:	new ark filename
//			old ark filename
// returns:	true if renamed successfully
bool ArkHdrPair::RenameFile(const char* newArkFilename, const char* oldArkFilename)
{
	// get old file entry
	// no need to search using First and Next as if the filename exists
	// it will be found first go and returned first go
	FileEntrySetIter iter;
	const FileEntry* p_entry = First(iter, oldArkFilename);
	if(p_entry == NULL)
		return false;
	
	// create new file entry
	FileEntry new_entry(newArkFilename, p_entry->Filename(),
		p_entry->Filesize(), p_entry->Offset(), p_entry->Encrypted());
	
	// replace file entry
	mFileCollection.Remove(iter);
	mHasChanged = true;
	return mFileCollection.Insert(new_entry);
}
开发者ID:mtolly,项目名称:onyxite-customs,代码行数:25,代码来源:ArkHdrPair.cpp

示例12: RecsDoneLock

void cRecsDone::RemoveSearchID(int ID)
{
    if (ID == -1)
	return;
    cMutexLock RecsDoneLock(this);
    if (Count() == 0)
	Load(AddDirectory(CONFIGDIR, "epgsearchdone.data"));
    cRecDone* recDone = First();
    while (recDone)
    {
	if (recDone->searchID == ID)
	{
	    recDone->searchID = -1;
	    LogFile.Log(2,"search timer %d removed in recording %s~%s", ID, recDone->title?recDone->title:"unknown title", recDone->shortText?recDone->shortText:"unknown subtitle");
	}
	recDone = Next(recDone);
    }
    Save();
}
开发者ID:FFTEAM,项目名称:evolux-spark-sh4,代码行数:19,代码来源:recdone.c

示例13: Last

nsTreeRows::iterator
nsTreeRows::FindByResource(nsIRDFResource* aResource)
{
    // XXX Mmm, scan through the rows one-by-one...
    iterator last = Last();
    iterator iter;

    nsresult rv;
    nsAutoString resourceid;
    bool stringmode = false;

    for (iter = First(); iter != last; ++iter) {
        if (!stringmode) {
            nsCOMPtr<nsIRDFResource> findres;
            rv = iter->mMatch->mResult->GetResource(getter_AddRefs(findres));
            if (NS_FAILED(rv)) return last;

            if (findres == aResource)
                break;

            if (! findres) {
                const char *uri;
                aResource->GetValueConst(&uri);
                CopyUTF8toUTF16(uri, resourceid);

                // set stringmode and fall through
                stringmode = true;
            }
        }

        // additional check because previous block could change stringmode
        if (stringmode) {
            nsAutoString findid;
            rv = iter->mMatch->mResult->GetId(findid);
            if (NS_FAILED(rv)) return last;

            if (resourceid.Equals(findid))
                break;
        }
    }

    return iter;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:43,代码来源:nsTreeRows.cpp

示例14: botmeld

void botmeld(){
	sortcard(&Hand(player_who_play),1);
	addressCard T = First(Hand(player_who_play));
	addressCard X = NULL;
	while(T != NULL){
		int t = trees(Hand(player_who_play),Card(T));
		int i = 1;	
		if(t>2){
			while(i <= t){
				X = T;
				T = Next(T);
				doMeld(Card(X));
				i++;
			}
		}else{
			T = Next(T);
		}
	}
}
开发者ID:qornanali,项目名称:Rummy-C,代码行数:19,代码来源:bot.c

示例15: Check_Object

//
//#############################################################################
// GetNthImplementation
//#############################################################################
//
void*
	PlugIterator::GetNthImplementation(
		CollectionSize index
	)
{
	Check_Object(this);
	CollectionSize i = 0;
	void *item;

	First();
	while ((item = GetCurrentImplementation()) != NULL)
	{
		if (i == index)
			return item;
      Next();
		i++;
	}
	return NULL;
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:24,代码来源:plug.cpp


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