Beispiel #1
0
char *
GetMoviePathName(dbADT db,const char * movieName)
{
    genreNode * genreN;
    movieNode * movieN;
    char * resp; 
    int i=0,j=0;
    if(db==NULL || movieName==NULL)
	return NULL;
    if( listIsEmpty(db->genreList) )
	return NULL;
    SetBegin(db->genreList);
    while( GetData(db->genreList,(listElementT*)&genreN)!=0 && i<db->cantGenre)
    {
	if( !listIsEmpty(genreN->movieList) )
	{
	    SetBegin(genreN->movieList);
	    while( GetData(genreN->movieList,(listElementT*)&movieN) && j<genreN->cantMoviesGenre)
	    {
			if( strcmp(movieN->movie.name,movieName)==0 )
			{
				if( (resp=malloc(sizeof(char)*(strlen(movieN->pathName)+1)))==NULL )
				return NULL;
				strcpy(resp,movieN->pathName);
				return resp;
			}
		j++;
	    }
		j=0;
	}
	i++;
    }
    return NULL;
}
Beispiel #2
0
int
BelongsToList( listADT list, listElementT elemento)
{
	nodoCDT * actual;
	listElementT dato;
	char msg[200];
	int aux;
	int rta;

	if( list ==NULL)
		return 0;
	
	// Guardamos el actual del iterador para restaurarlo al final
	actual = list->actual;
		
	// Seteamos el iterador al comienzo
	SetBegin(list);
	
	// Recorrenmos mientras haya datos y el elemento no sea mayor al que busco
	while((aux=GetDato(list, &dato,msg)) && (dato > elemento));

	// Restauramos el valor del iterador
	list->actual = actual;
	rta = (dato == elemento);
		
	return rta;
}
Beispiel #3
0
 /** Mark the main information for a bond
     \param idx The unique bond index for this bond (inside an OBMol)
     \param begin The 'beginning' atom for the bond
     \param end The 'end' atom for the bond
     \param order The bond order (i.e., 1 = single, 2 = double... 5 = aromatic)
     \param flags Any initial property flags
  **/
 void OBBond::Set(int idx,OBAtom *begin,OBAtom *end,int order,int flags)
 {
   SetIdx(idx);
   SetBegin(begin);
   SetEnd(end);
   SetBondOrder(order);
   SetFlag(flags);
 }
Beispiel #4
0
BOOL CTElection::Restore( CQuery* pQuery )
{	// 데이터베이스로부터 선거 상태 복원
	if( !pQuery->Execute( "uspRestoreElection %d", g_appInfo.dwSys ) )
		return FALSE;
	if( pQuery->Fetch() )
	{
		m_idElection	= pQuery->GetInt( "idElection" );
		ELECTION_STATE eState	= static_cast<ELECTION_STATE>( pQuery->GetInt( "eState" ) );
		SetState( eState );
		SetRequirement( (int)( pQuery->GetInt( "nRequirement" ) * property.fRequirementFactor ) );
		char szBegin[17]	= { 0,};
		pQuery->GetStr( "szBegin", szBegin );
		SetBegin( CTElection::stot( szBegin ) );
	}
	if( !pQuery->Execute( "uspRestoreCandidates %d, %d", g_appInfo.dwSys, GetId() ) )
	{
		Error( "couldn't execute uspRestoreCandidates" );
		return FALSE;
	}
	while( pQuery->Fetch() )
	{
		u_long idPlayer		= static_cast<u_long>( pQuery->GetInt( "idPlayer" ) );
		__int64 iDeposit	= pQuery->GetInt64( "iDeposit" );
		char szPledge[CCandidate::nMaxPledgeLen]	= { 0,};
		pQuery->GetStr( "szPledge", szPledge );
		int nVote	= pQuery->GetInt( "nVote" );
		time_t tCreate	= pQuery->GetInt( "tCreate" );
		AddCandidate( idPlayer, iDeposit, szPledge, nVote, tCreate );
	}
	if( GetState() == eVote )	// 투표 상태면
		SortVote();		// 득표수로 정렬
	else	// 그 밖의 상태라면
		SortDeposit();	// 입찰금으로 정렬
	
	if( !GetBegin() || GetState() == eExpired )	// 최초 실행이거나 만료된 선거라면
	{
		PrepareNext();
		if( !pQuery->Execute( "uspElectionInitialize %d, %d, %s", g_appInfo.dwSys, GetId(), CTElection::ttos( GetBegin() ) ) )
		{
			Error( "couldn't execute uspElectionInitialize" );
			return FALSE;
		}
	}
	return TRUE;
}
Beispiel #5
0
static genreNode *
GetGenreNode(dbADT db ,const char * genre)
{
    genreNode * node;
    int i=0,salgo=0;
    if(listIsEmpty(db->genreList))
	return NULL;
    SetBegin(db->genreList);
    while(!salgo)
    {
	if(GetData(db->genreList,(listElementT*)&node)==0 || i==db->cantGenre)
	    salgo=1;
	else
	{
	    if(strcmp(node->genre,genre)==0)
		return node;
	    i++;
	}
    }
    return NULL;
}
Beispiel #6
0
void FXShader::SetRange(ObjectIterator begin,ObjectIterator end) {
    SetBegin(begin);
    SetEnd(end);
}
Beispiel #7
0
}

bool WgSpanItem::SkipBackward()
{
	int beg = begin;
	SetBegin( beg - _skipSize() );
Beispiel #8
0
}

bool WgSpanItem::SkipForward()
{
	int beg = begin;
	SetBegin( beg + _skipSize() );
Beispiel #9
0
void WgSpanItem::SetRelativeBegin( float _begin )
{
	int range = max - min;
	SetBegin( min + (int) (_begin*range) );
}
Beispiel #10
0
void WgSpanItem::SetRelativePos( float _pos )
{
	int range = max - min;
	SetBegin( min + (int) ((_pos*range*2)- length)/2 );
}