void CKSXML_Read_Project::Read_Bus(TiXmlElement* pElement)
{
	return;
	if ( !pElement ) return ;
	
	TiXmlAttribute* pAttrib	=	pElement->FirstAttribute();
	tint32 ival;
	
	// sample id
	if (pAttrib->QueryIntValue(&ival)==TIXML_SUCCESS)    
		;//printf( "bus id =  %d \n", ival);
	
	TiXmlNode* pChild;
	
	for ( pChild = pElement->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
		
		if(pChild->Type() == TiXmlNode::ELEMENT){
			
			if (stricmp("out", pChild->Value()) == 0) {
			//	Read_Track_Out(pChild->ToElement(), ival);
				
			}
			else if (stricmp("aux", pChild->Value()) == 0) {
			//	Read_Track_Aux(pChild->ToElement(), ival);
				
			}
			/*
			else if (stricmp("insert", pChild->Value()) == 0) {
				Read_Track_Insert(pChild->ToElement());
				
			}
			 */
		}
	}
}
示例#2
0
    int xmlStructure::dump_attribs_to_stdout ( TiXmlElement* pElement, unsigned int indent )
    {
        if ( !pElement )
            return 0;

        TiXmlAttribute* pAttrib = pElement->FirstAttribute();
        int i = 0;
        int ival;
        double dval;
        const char* pIndent = getIndent ( indent );
        printf ( "\n" );
        while ( pAttrib )
        {
            printf ( "%s%s: value=[%s]", pIndent, pAttrib->Name(), pAttrib->Value() );

            if ( pAttrib->QueryIntValue ( &ival ) == TIXML_SUCCESS )
                printf ( " int=%d", ival );
            if ( pAttrib->QueryDoubleValue ( &dval ) == TIXML_SUCCESS )
                printf ( " d=%1.1f", dval );
            printf ( "\n" );
            i++;
            pAttrib = pAttrib->Next();
        }
        return i;
    }
void CKSXML_Read_Project::Read_Bus_Aux(TiXmlElement* pElement)
{
	if ( !pElement ) return ;
	
	TiXmlAttribute* pAttrib	=	pElement->FirstAttribute();
	tint32 ival;
	
	// aux id
	if (pAttrib->QueryIntValue(&ival)==TIXML_SUCCESS)    
		;//printf( "AUX %d ", ival);
	
	TiXmlNode* pChild;
	
	for ( pChild = pElement->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
		
		if(pChild->Type() == TiXmlNode::ELEMENT){
			
			if (stricmp("send", pChild->Value()) == 0) {

				Set_DAW_Parameter(pChild, giTinyXml_Type_Float, 0, 0);

			}
		}
	}
}
示例#4
0
int TiXmlElement::QueryIntAttribute( const TCHAR* name, int* ival ) const
{
	TiXmlAttribute* node = attributeSet.Find( name );
	if ( !node )
		return TIXML_NO_ATTRIBUTE;

	return node->QueryIntValue( ival );
}
示例#5
0
info_t *CLinhaXML::getInfo(){
	
	if(!getLinhaXML())
		return NULL;
	//Pega argumentos da linha passados na tag
	char *argumento;
	
	TiXmlAttribute *pAttrib = linhaXML->ToElement()->FirstAttribute();
	
	//printf("\n");
	while (pAttrib)
	{
		argumento = (char*)pAttrib->Name();
		switch(*argumento){
			case 't': 
				pAttrib->QueryIntValue(&info.top);
				break;
			case 'l':
				pAttrib->QueryIntValue(&info.left);
				break;
			case 'w':
				pAttrib->QueryIntValue(&info.width);
				break;
			case 'h':
				pAttrib->QueryIntValue(&info.height);
				break;
			case 'f':
				pAttrib->QueryIntValue(&info.font);
				break;		
		}
		info.bottom = info.top + info.height;
		info.right  = info.left + info.width;
		info.area   = info.height * info.width;
		
		pAttrib=pAttrib->Next();
	}
/*
	printf("t%-4d b%-4d l%-4d r%-4d w%-4d h%-4d a%-8d f%-4d n%-4d i%-4d\n", info.top, info.bottom,
															 info.left, info.right, 
															 info.width,info.height, 
															 info.area, info.font,
															 info.negrito, info.italico);
*/
	return &info;
	
}
void CKSXML_Read_Project::Read_Master_Insert(TiXmlElement* pElement)
{
	if ( !pElement ) return ;
	
	TiXmlAttribute* pAttrib	=	pElement->FirstAttribute();
	tint32 ival;
	
	// aux id
	if (pAttrib->QueryIntValue(&ival)==TIXML_SUCCESS)    
		;//printf( "insert slot;%d,  ", ival);
	
	if(pAttrib=pAttrib->Next())
		
		// aux id
		if (pAttrib->QueryIntValue(&ival)==TIXML_SUCCESS)    
			;//printf( "id:%d \n", ival);
	
}
void LibraryParser::GetInterfaceAttributes(TiXmlNode* pParent) {
	TiXmlAttribute* Attribute = ( pParent->ToElement())->FirstAttribute() ;
	string Name;
	string Type;
	int Count = 1;
	while (Attribute ) {
		if (string(Attribute->Name() ) == "name") {
			Name = Attribute->ValueStr() ;
		} else if (string(Attribute->Name() ) == "type") {
			Type = Attribute->ValueStr() ;
		} else if (string(Attribute->Name() ) == "count") {
			Attribute->QueryIntValue(&Count) ;
		}
		Attribute = Attribute->Next() ;
	}
	//Add the interface to the current node
	mCurrentNode.Add(Name, Type, Count) ;
}
void WindowUser::ReadXML()
{


        doc.LoadFile();

       TiXmlNode *patr=doc.FirstChild();


    int i=0;
    while(patr){
        int x,y;


        TiXmlAttribute *atrX =patr->ToElement()->FirstAttribute();
        TiXmlAttribute *atrY =patr->ToElement()->LastAttribute();


        atrX->Next()->QueryIntValue(&x);
        //cout<<x<<endl;

        atrY->QueryIntValue(&y);
        //cout<<y<<endl;


//        cout<<patr->ToElement()->Attribute("Codigo")<<endl;
//        cout<<patr->ToElement()->Attribute("X")<<endl;
//        cout<<patr->ToElement()->Attribute("Y")<<endl;

          QLabel *pin =new QLabel(this);
          QPixmap qp=QPixmap(":/imgs/map-pin-md.png");
          pin->setPixmap(qp);
          pin->setGeometry(x,y,20,25);
          pin->setScaledContents(true);
          pin->raise();
          pin->show();
        patr=patr->NextSibling();
        i++;
    }



}
//Función que vuelca el contenido de los atributos de un elemento del fichero XML, y
// devuelve el número de atributos del elemento.
int cLoadXML::Output_attributes(TiXmlElement* lpElement, unsigned int luiIndent)
{
	if ( !lpElement ) return 0;
    //Se accede al primer atributo del elemento.
	TiXmlAttribute* lpAttrib = lpElement->FirstAttribute();
	int i = 0;
	int liVal;
	double ldVal;
	//Se obtiene la cadena de indentación.
	const char* kpcIndent = GetIndent(luiIndent, true);
	OutputDebugString("\n");
	//Se recorren los atributos.
	while (lpAttrib)
	{
		//Se imprime la indentación concatenada con el nombre del atributo y su valor.
		OutputDebugString( ((std::string)kpcIndent + lpAttrib->Name() + ": value = " + lpAttrib->Value()).c_str());		
		//"QueryIntValue()" es una alternativa al método IntValue() con verificación de error. Si el valor del atributo es integer, es almacenado en el parámetro
		// "liVal" y se retorna TIXML_SUCCESS. Si no es integer se devuelve TIXML_WRONG_TYPE.
		if (lpAttrib->QueryIntValue(&liVal)==TIXML_SUCCESS)
		{
			char lpcCadenaNum[4];
			//Convertimos el número integer en cadena
			sprintf_s(lpcCadenaNum, 4, "%d", liVal);
			OutputDebugString((", the value is integer = " + (std::string)lpcCadenaNum).c_str());
		}
		//"QueryDoubleValue()" es una alternativa al método DoubleValue() con verificación de error. Si el valor del atributo es double, es almacenado en el parámetro
		// "ldVal" y se retorna TIXML_SUCCESS. Si no es double se devuelve TIXML_WRONG_TYPE.
		else if (lpAttrib->QueryDoubleValue(&ldVal)==TIXML_SUCCESS)
		{
			char lpcCadenaNum[20];
			//Convertimos el número integer en cadena
			sprintf_s(lpcCadenaNum, 20, "%0.2f", ldVal);
			OutputDebugString((", the value is double = " + (std::string)lpcCadenaNum).c_str());
		}			
		OutputDebugString("\n");
		i++;
		//Next(): Get the next sibling attribute in the DOM. Returns null at end. 
		lpAttrib=lpAttrib->Next();
	}
	//Se devuelve el número de atributos
	return i;
}
void HoOrionModelParser::ParseWire(TiXmlNode* pParent) {
	double C, R, Pitch;
	int Layer;
	TiXmlAttribute* Attribute = ( pParent->ToElement())->FirstAttribute() ;
	while (Attribute ) {
		if (string(Attribute->Name() ) == "type") {
		} else if (string(Attribute->Name() ) == "layer") {
			Attribute->QueryIntValue(&Layer) ;
		} else if (string(Attribute->Name() ) == "r") {
			Attribute->QueryDoubleValue(&R) ;
		} else if (string(Attribute->Name() ) == "c") {
			Attribute->QueryDoubleValue(&C) ;
		} else if (string(Attribute->Name() ) == "pitch") {
			Attribute->QueryDoubleValue(&Pitch) ;
		} else {
			cout << "Unknown attribute "<< Attribute->Name() << " for wire"
					<< endl ;
		}
		Attribute = Attribute->Next() ;
	}
	mR[Layer] = R ;
	mC[Layer] = C ;
	mPitch[Layer] = Pitch ;
}
void CKSXML_Create_Project::Parse_Project_Info(TiXmlNode* pParent)
{
	if ( !pParent ) return ;

	
	TiXmlAttribute* pAttrib	=	pParent->ToElement()->FirstAttribute();
	tint32 ival;
	
	// set project ID
	if (pAttrib && pAttrib->QueryIntValue(&ival)==TIXML_SUCCESS)  {
		
		gpApplication->SetGlobalParm(giParamID_Project_ID, ival, giSectionGlobal);
		
	}
		
	
	// parse all childs
	TiXmlNode* pChild;
	for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) 
	{
		if(pChild->Type() == TiXmlNode::ELEMENT)
			Write_Project_Info(pChild);
	}
}
void HoOrionModelParser::ParseRouter(TiXmlNode* pParent) {
	double TmpDouble;
	int TmpInt;
	string Type;
	stringstream Energy;
	stringstream Area;
	int MaxIn = 0;
	int MaxOut = 0;
	TiXmlAttribute* Attribute = ( pParent->ToElement())->FirstAttribute() ;
	while (Attribute ) {
		if (string(Attribute->Name() ) == "type") {
			Type = string(Attribute->Value() ) ;
		} else if (string(Attribute->Name() ) == "maxin") {
			Attribute->QueryIntValue(&TmpInt) ;
			MaxIn = TmpInt ;
		} else if (string(Attribute->Name() ) == "maxout") {
			Attribute->QueryIntValue(&TmpInt) ;
			MaxOut = TmpInt ;
		} else if (string(Attribute->Name() ) == "maxbw") {
			Attribute->QueryDoubleValue(&TmpDouble) ;
			//mModel->RouterMaxBw = TmpDouble ;
		} else if (string(Attribute->Name() ) == "energy") {
			Energy << Attribute->ValueStr() ;
		} else if (string(Attribute->Name() ) == "area") {
			Area << Attribute->ValueStr() ;
		} else {
			cout << "Unknown attribute "<< Attribute->Name() << " for wire"
					<< endl ;
		}
		Attribute = Attribute->Next() ;
	}

	mMaxIn = MaxIn ;
	mMaxOut = MaxOut ;

	if (Type == "r1ch32") {
		mArouter1ch32.resize(MaxIn + 1) ;
		mErouter1ch32.resize(MaxIn + 1) ;
		mErouterLeak1ch32.resize(MaxIn + 1) ;
		mArouter1ch32[0].resize(MaxOut + 1) ;
		mErouter1ch32[0].resize(MaxOut + 1) ;
		mErouterLeak1ch32[0].resize(MaxOut + 1) ;
		for (int i = 1; i <= MaxIn ; i++) {
			mArouter1ch32[i].resize(MaxOut + 1) ;
			mErouter1ch32[i].resize(MaxOut + 1) ;
			mErouterLeak1ch32[i].resize(MaxOut + 1) ;
			for (int j = 1; j <= MaxOut ; j++) {
				Area >> mArouter1ch32[i][j];
				mArouter1ch32[i][j] = mArouter1ch32[i][j]*1e-12;
				Energy >> mErouter1ch32[i][j];
				Energy >> mErouterLeak1ch32[i][j];
			}
		}

		//handle first rows nad first column
		for (int j = 0; j <= MaxOut ; j++) {
			mArouter1ch32[0][j] = 0;
			mErouter1ch32[0][j] = 0;
			mErouterLeak1ch32[0][j] = 0;
		}
		for (int i = 0; i <= MaxIn ; i++) {
			mArouter1ch32[i][0] = 0;
			mErouter1ch32[i][0] = 0;
			mErouterLeak1ch32[i][0] = 0;
		}

	} else if (Type == "r4ch32") {
示例#13
0
bool CGmObjShapeStaticItem::ReadXML( TiXmlNode* poParent, unsigned int uiCounter )
{
	if( !poParent )
		return false;
	
	static char acTxt_[256];
	if( uiCounter == 0 )
	{
	}
	
	switch ( poParent->Type() )
	{
	case TiXmlNode::DOCUMENT:
		LOG( "XML: Document" );
	break;
	case TiXmlNode::ELEMENT:
	{
		const char *pcName = poParent->Value();
		//LOG( "name: %s\n", pcName );
		if( !strcmp( pcName, "item" ) )
		{
			LOG( "item:\n" );
			
			TiXmlElement * poElement = poParent->ToElement();
			if( poElement )
			{
				TiXmlAttribute* poAttrib = poElement->FirstAttribute();
				while( poAttrib )
				{
					const char *pcName = poAttrib->Name();
					if( !strcmp( pcName, "name" ) )
					{
						STRING_COPY( acTxt_, sizeof(acTxt_), poAttrib->Value() );
						LOG( "%s: %s\n", poAttrib->Name(), acTxt_ );
						m_oName = acTxt_;
					}
					if( !strcmp( pcName, "type" ) )
					{
						STRING_COPY( acTxt_, sizeof(acTxt_), poAttrib->Value() );
						LOG( "%s: %s\n", poAttrib->Name(), acTxt_ );
						if( !strcmp( acTxt_, "weapon" ) )
							m_eType = TYPE_WEAPON;
						else if( !strcmp( acTxt_, "energy" ) )
							m_eType = TYPE_ENERGY;
						else if( !strcmp( acTxt_, "ammo" ) )
							m_eType = TYPE_AMMO;
						else if( !strcmp( acTxt_, "key" ) )
							m_eType = TYPE_KEY;
						else
							m_eType = TYPE_UNDEFINED;
					}
					if( !strcmp( pcName, "cycle_duration" ) )
					{
						double dVal;
						if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
						{
							LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
							if( dVal >= 0.0 )
								m_iTickDurCycle = int( dVal / m_dTInteractionInterval_ );
							else
								m_iTickDurCycle = -1;
						}
					}
					if( !strcmp( pcName, "rotation_y_speed" ) )
					{
						double dVal;
						if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
						{
							LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
							m_fRotationYSpeed = float( dVal * 360.0 );
						}
					}
					if( !strcmp( pcName, "weapon_name" )
					 && ( m_eType == TYPE_WEAPON || m_eType == TYPE_AMMO ) )
					{
						STRING_COPY( acTxt_, sizeof(acTxt_), poAttrib->Value() );
						LOG( "%s: %s\n", poAttrib->Name(), acTxt_ );
						m_oWeaponName = acTxt_;
					}
					if( !strcmp( pcName, "energy" ) && m_eType == TYPE_ENERGY )
					{
						double dVal;
						if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
						{
							LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
							m_fEnergy = float( dVal );
						}
					}
					if( !strcmp( pcName, "ammo" )
					 && ( m_eType == TYPE_WEAPON || m_eType == TYPE_AMMO ) )
					{
						int iVal;
						if( poAttrib->QueryIntValue( &iVal ) == TIXML_SUCCESS
						 && iVal > 0 )
						{
							LOG( "%s: %d\n", poAttrib->Name(), iVal );
							m_uiAmmo = iVal;
						}
					}
					if( !strcmp( pcName, "key" ) && m_eType == TYPE_ENERGY )
					{
						int iVal;
						if( poAttrib->QueryIntValue( &iVal ) == TIXML_SUCCESS
						 && iVal > 0 )
						{
							LOG( "%s: %d\n", poAttrib->Name(), iVal );
							m_uiKey = iVal;
						}
					}
					poAttrib = poAttrib->Next();
				}
			}
		}
		if( !strcmp( pcName, "animation" ) )
		{
			LOG( "animation:\n" );
			
			TiXmlElement * poElement = poParent->ToElement();
			if( poElement )
			{
				TiXmlAttribute* poAttrib = poElement->FirstAttribute();
				while( poAttrib )
				{
					const char *pcName = poAttrib->Name();
					if( !strcmp( pcName, "file_name" ) )
					{
						STRING_COPY( acTxt_, sizeof(acTxt_), poAttrib->Value() );
						LOG( "%s: %s\n", poAttrib->Name(), acTxt_ );
						m_poAnim = m_poResMan_->NewAnim3( CStr( "item/" ) + acTxt_ );
					}
					poAttrib = poAttrib->Next();
				}
			}
		}
		// Gleich wie in GmObjShapeDynamicEnemy.cpp.
		if( !strcmp( pcName, "mesh" ) )
		{
			LOG( "mesh:\n" );

			CStr oFileName, oSubDir;

			TiXmlElement * poElement = poParent->ToElement();
			if( poElement )
			{
				TiXmlAttribute* poAttrib = poElement->FirstAttribute();
				while( poAttrib )
				{
					const char *pcName = poAttrib->Name();
					if( !strcmp( pcName, "sub_dir" ) )
					{
						STRING_COPY( acTxt_, sizeof(acTxt_), poAttrib->Value() );
						LOG( "%s: %s\n", poAttrib->Name(), acTxt_ );
						oSubDir = acTxt_;
					}
					else if( !strcmp( pcName, "file_name" ) )
					{
						STRING_COPY( acTxt_, sizeof(acTxt_), poAttrib->Value() );
						LOG( "%s: %s\n", poAttrib->Name(), acTxt_ );
						oFileName = acTxt_;
					}
					poAttrib = poAttrib->Next();
				}
			}
			if( oFileName.GetSize() )
			{
				CGMesh * poMesh( m_poResMan_->NewMeshObj( oSubDir, oFileName ) ); //, false, false ) );
				if( poMesh )
				{
					m_oLstMesh.Append( poMesh );
				}
			}
		}
	}
	break;
	case TiXmlNode::COMMENT:
		//LOG( "XML: Comment: [%s]", poParent->Value());
	break;
	case TiXmlNode::UNKNOWN:
		//LOG( "XML: Unknown" );
	break;
	case TiXmlNode::TEXT:
		//LOG( "XML: Text: [%s]", poParent->ToText()->Value() );
	break;
	case TiXmlNode::DECLARATION:
		//LOG( "XML: Declaration" );
	break;
	default:
	break;
	}
	LOG( "\n" );

	++uiCounter;

	for( TiXmlNode* poChild = poParent->FirstChild(); poChild != 0; poChild = poChild->NextSibling() )
	{
		ReadXML( poChild, uiCounter );
	}
	
	// Ganz am Schluss...
	if( uiCounter == 1 )
	{
	}
	return true;
}
示例#14
0
int CSkeleton::CBone::ReadXMLAttrib( TiXmlElement* poElement )
{
	if( !poElement )
		return 0;
	
	TiXmlAttribute* poAttrib = poElement->FirstAttribute();
	int i = 0;
	int iVal;
	double dVal;
	static char acName_[256];
	
	while( poAttrib )
	{
		const char *pcName = poAttrib->Name();
		if( !strcmp( pcName, "name" ) )
		{
			SKELETON_STR_COPY( acName_, sizeof(acName_), poAttrib->Value() );
			SKELETON_LOG( "name: %s\n", acName_ );
			m_oName = acName_;
		}
		else if( !strcmp( pcName, "parent_index" ) )
		{
			if( poAttrib->QueryIntValue( &iVal ) == TIXML_SUCCESS )
			{
				SKELETON_LOG( "%s: %d\n", poAttrib->Name(), iVal );
				m_iIndexParent = iVal;
			}
		}
		else if( !strcmp( pcName, "head_x" ) )
		{
			if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
			{
				SKELETON_LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
				m_oHead[0] = float( dVal );
			}
		}
		else if( !strcmp( pcName, "head_y" ) )
		{
			if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
			{
				SKELETON_LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
				m_oHead[1] = float( dVal );
			}
		}
		else if( !strcmp( pcName, "head_z" ) )
		{
			if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
			{
				SKELETON_LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
				m_oHead[2] = float( dVal );
			}
		}
		else if( !strcmp( pcName, "tail_x" ) )
		{
			if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
			{
				SKELETON_LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
				m_oTail[0] = float( dVal );
			}
		}
		else if( !strcmp( pcName, "tail_y" ) )
		{
			if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
			{
				SKELETON_LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
				m_oTail[1] = float( dVal );
			}
		}
		else if( !strcmp( pcName, "tail_z" ) )
		{
			if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS )
			{
				SKELETON_LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) );
				m_oTail[2] = float( dVal );
			}
		}
#define CHECK_M( i, j ) \
		else if( !strcmp( pcName, "m" #i #j ) ) \
		{ \
			if( poAttrib->QueryDoubleValue( &dVal ) == TIXML_SUCCESS ) \
			{ \
				SKELETON_LOG( "%s: %f\n", poAttrib->Name(), float( dVal ) ); \
				m_oTransform( i, j ) = float( dVal ); \
			} \
		}
		CHECK_M( 0, 0 )
		CHECK_M( 1, 0 )
		CHECK_M( 2, 0 )
		CHECK_M( 3, 0 )
		CHECK_M( 0, 1 )
		CHECK_M( 1, 1 )
		CHECK_M( 2, 1 )
		CHECK_M( 3, 1 )
		CHECK_M( 0, 2 )
		CHECK_M( 1, 2 )
		CHECK_M( 2, 2 )
		CHECK_M( 3, 2 )
		CHECK_M( 0, 3 )
		CHECK_M( 1, 3 )
		CHECK_M( 2, 3 )
		CHECK_M( 3, 3 )
#undef CHECK_M
		else
		{
			//m_bError = true;
			SKELETON_ERR( "undefined attribute, %s\n", pcName );
		}
		i++;
		poAttrib = poAttrib->Next();
	}
	return i;
}
void CKSXML_Read_Project::Read_Track_Insert(TiXmlElement* pElement, tint32 uTrack)
{
	if ( !pElement ) return ;
	
	TiXmlAttribute* pAttrib	=	pElement->FirstAttribute();
	tint32 iSlot;

	// slot id
	if(pAttrib->QueryIntValue(&iSlot)!=TIXML_SUCCESS) 
		return;
	
	tint32 iVendor = -1;
	tint32 iProduct = -1;
	tint32 iInternal_Product_ID = -1;
	
	
	TiXmlNode* pChild;
	for ( pChild = pElement->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
		
		if(pChild->Type() == TiXmlNode::ELEMENT){
			
			if (stricmp("productId", pChild->Value()) == 0) {

				//Set_DAW_Parameter(pChild, giTinyXml_Type_Int, giParam_ChInsert1 + iSlot, giSection_First_Track + uTrack);
			}
			
			else if (stricmp("vendor", pChild->Value()) == 0) {
				
				TiXmlAttribute* pVendor_Attrib	=	pChild->ToElement()->FirstAttribute();
				if(pVendor_Attrib)
					pVendor_Attrib->QueryIntValue(&iVendor);
				
				//Set_DAW_Parameter(pChild, giTinyXml_Type_String, 0, 0);
				
			}
			else if (stricmp("product", pChild->Value()) == 0) {
				
				TiXmlAttribute* pProduct_Attrib	=	pChild->ToElement()->FirstAttribute();
				if(pProduct_Attrib)
					pProduct_Attrib->QueryIntValue(&iProduct);

				//Set_DAW_Parameter(pChild, giTinyXml_Type_String, 0, 0);

			}
			else if (stricmp("url", pChild->Value()) == 0) {

				Set_DAW_Parameter(pChild, giTinyXml_Type_String, 0, 0);

			}
			else if (stricmp("bypass", pChild->Value()) == 0) {

				Set_DAW_Parameter(pChild, giTinyXml_Type_String, 0, 0);

			}
			else if (stricmp("settings", pChild->Value()) == 0) {
				Read_Insert_Settings(pChild->ToElement());

			}
		}
	}
	
	if( iVendor != -1 && iProduct != -1) {
		
		// do some math h
		
		tint32 iValue = iProduct;
		if (iVendor != 2) {
			iValue = iVendor << 8 | iProduct;
		}
		
		gpApplication->SetGlobalParm( giParam_ChInsert1 + iSlot, iValue, giSection_First_Track + uTrack);
		
	}
}
void CKSXML_Read_Project::Parse_Track_Object(TiXmlElement* pElement)
{
	if ( !pElement ) return ;
	

	TiXmlAttribute* pAttrib	=	pElement->FirstAttribute();
	//  track uuid
	std::string sTrack_UUID;
	if(pAttrib) {
		sTrack_UUID =  pAttrib->Value() ;
		
		
	}
	
	// owerwrite
	tint32 iTrackID = gpApplication->AddTrack();
	
	if(iTrackID == -1) return;
	
	gpApplication->Set_Track_UUID(iTrackID, sTrack_UUID.c_str() );
		
	
	TiXmlNode* pChild;
	
	for ( pChild = pElement->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
		
		if(pChild->Type() == TiXmlNode::ELEMENT){
			
			
			if (stricmp("name", pChild->Value()) == 0) {
				
				Read_Track_Name( pChild->ToElement(), iTrackID);
			}
			
			else if (stricmp("description", pChild->Value()) == 0) {
				
				//Read_Track_Name( pChild->ToElement(), iTrackID);
			}
			
			
			else if (stricmp("size", pChild->Value()) == 0) {
				Set_DAW_Parameter(pChild, giTinyXml_Type_Int, giParam_Track_Info_SizeY, giSection_First_Track + iTrackID);
			}
			
			else if (stricmp("in", pChild->Value()) == 0) {
				Read_Track_In(pChild->ToElement(),  iTrackID);
			//	printf( "\n" );
			}
			else if (stricmp("out", pChild->Value()) == 0) {
				Read_Track_Out(pChild->ToElement(),  iTrackID);
				
			}
			
			else if (stricmp("insert", pChild->Value() ) == 0) {
				Read_Track_Insert(pChild->ToElement(), iTrackID);
				
			}
			
			else if (stricmp("aux", pChild->Value()) == 0) {
				
				TiXmlElement* pElement	=	pChild->ToElement();
				TiXmlAttribute* pAttrib	=	pElement->FirstAttribute();
				tint32 iAux = -1;
				
				// aux id
				if (pAttrib && pAttrib->QueryIntValue(&iAux)!=TIXML_SUCCESS)    
					return;
				// Set value
				Set_DAW_Parameter(pElement, giTinyXml_Type_Float, giParam_ChAUX1 + iAux, giSection_First_Track + iTrackID, 10000.0f);

			}
			
			
			 
			else if (stricmp("region", pChild->Value()) == 0) {
				Read_Track_Region(pChild->ToElement(),  iTrackID);
				
			}
		}
	}
	
	muiTrack++;

}
示例#17
0
	void GuiMgrParser::OnXmlElement( TiXmlElement* element )
	{
		if(!element) return;

		TiXmlAttribute* pAttrib = element->FirstAttribute();


		if(strcmp(element->Value(), "listener") == 0)
		{
			std::string name = "default";
			while (pAttrib)
			{
				if(strcmp(pAttrib->Name(),"name") == 0) {
					name = pAttrib->Value();
				} else {
					error_log("Unhandled attribute when loading ui! %s", pAttrib->Name());
				}
				pAttrib = pAttrib->Next();
			}
			currentListener = name;
			m_tagLoc.push(Listener);
		} else if(strcmp(element->Value(),"widget") == 0) {
			switch(GetTagLocation())
			{
			case None:
			{
				Widget* temp = NULL;
				//it's a create widget xml syntax! 
				std::string widgetName; 
				int widgetType = WIDGET;
				while (pAttrib)
				{
					if(strcmp(pAttrib->Name(),"name") == 0)
						widgetName = pAttrib->Value();
					else if(strcmp(pAttrib->Name(),"type") == 0) {
						pAttrib->QueryIntValue(&widgetType);
					} else {
						error_log("Unhandled attribute when loading ui! %s", pAttrib->Name());
					}
					pAttrib = pAttrib->Next();
				}
				if(!m_loadLayout) {
					bool created = false;
					for(uint32 i=0; i<m_gui->m_factories.size(); i++) {
						if(m_gui->m_factories[i]->CanCreateWidget((uint32)widgetType)) {
							temp = m_gui->m_factories[i]->CreateWidget((uint32)widgetType);
							if(temp) {
								created = true;
								temp->SetName(widgetName);
								temp->SetLoading(true);
							}
							
							break;						
						}
					}
					if(!created) {
						error_log("No factory was able to create a widget of type: %u!", widgetType);
					} else {
						m_widgetInfos.push(WidgetInfo(temp,(uint32)widgetType));
					}
				} else {
					Widget* temp = NULL;
					if(m_widgets.size()) {
						Widget*	parent = m_widgets.top();
						temp = parent->FindChildByName(widgetName);
						if(!temp) {
							debug_log("Couldn't find widget %s while loading layout!", widgetName.c_str());
						} else {
							m_widgets.push(temp);
						}
					} else {
						Widget* temp = NULL;
						temp = m_gui->GetWidgetByName(widgetName);
						if(!temp) {
							debug_log("Couldn't find widget %s while loading layout!", widgetName.c_str());
						} else {
							m_widgets.push(temp);
						}
					}
				}
			} break;
			case Listener:
			{
				std::string widgetName; int eventType(0);
				while (pAttrib)
				{
					if(strcmp(pAttrib->Name(),"name") == 0)
						widgetName = pAttrib->Value();
					else if(strcmp(pAttrib->Name(),"event") == 0) {
						pAttrib->QueryIntValue(&eventType);
					} else {
						error_log("Unhandled attribute when loading ui! %s", pAttrib->Name());
					}
					pAttrib = pAttrib->Next();
				}
				//if inside a <widget> tag
				if(m_widgetInfos.size()) {
					WidgetInfo& w = m_widgetInfos.top();
					if(w.m_listenerInfo.find(currentListener) != w.m_listenerInfo.end()) {
						ListenerInfo& li = w.m_listenerInfo[currentListener];
						li[eventType].push_back(widgetName);
					} else {
						ListenerInfo& li = w.m_listenerInfo[currentListener];
						li[eventType].push_back(widgetName);
					}
				} else {
					ListenerInfo& li = m_guiInfo.m_listenerInfos[currentListener];
					li[eventType].push_back(widgetName);
				}
			} break;
			default: break;
			} 
		} else if(strcmp(element->Value(),"property") == 0) { 
			if(!m_loadLayout) {
				if(!m_widgetInfos.size()) {
					debug_log("Tried to load properties, but no widget was found!");
				} else {
					Widget* widget = m_widgetInfos.top().m_widget;
					widget->m_settings.Load(element);
					widget->ReloadSettings();
				}
			} else {
				if(!m_widgets.size()) {
					debug_log("Tried to load properties, but no widget was found!");
				} else {
					m_widgets.top()->m_settings.Load(element);
					m_widgets.top()->ReloadSettings();
				}
			}
		} else if(strcmp(element->Value(),"theme") == 0) {
			std::string themeName;
			while (pAttrib)
			{
				if(strcmp(pAttrib->Name(),"name") == 0) {
					themeName = pAttrib->Value(); 
				} else {
					error_log("Unhandled attribute when loading theme! %s", pAttrib->Name());
				}
				pAttrib = pAttrib->Next();
			}			
			Theme* theme = new Theme(themeName);
			theme->LoadFromXml(element);	//load user-defined data

			m_gui->SetTheme(theme);
		} else {
			//debug_log("Unhandled tag-case %s", element->Value());
		}
	}
示例#18
0
void SE_ImageDataHandler::handle(SE_Element* parent, TiXmlElement* xmlElement, unsigned int indent)
{
    if(!xmlElement)
        return;
    int ival = -1;
    TiXmlAttribute* pAttribute = xmlElement->FirstAttribute();
    while(pAttribute)
    {
        const char* name = pAttribute->Name();
        const char* value = pAttribute->Value();
        if(!strcmp(name , "FileName"))
        {
            parent->setImageDataID(value);
        }
        else if(!strcmp(name, "x"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                parent->setImageDataX(ival);
            }
            else
            {
                LOGI("... parse image data x error\n");
            }
        }
        else if(!strcmp(name, "y"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                parent->setImageDataY(ival);
            }
            else
            {
                LOGI("... parse image data y error\n");
            }
        }
        else if(!strcmp(name, "width"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                parent->setImageDataWidth(ival);
            }
            else
            {
                LOGI("... parse image data width error\n");
            }
        }
        else if(!strcmp(name, "height"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                parent->setImageDataHeight(ival);
            }
            else
            {
                LOGI("... parse image data height error\n");
            }
        }
        pAttribute = pAttribute->Next();
    }
}
示例#19
0
void SE_TextureCoordAnimationHandler::handle(SE_Element* parent, TiXmlElement* xmlElement, unsigned int indent)
{
    if(!xmlElement)
        return;
    int ival = -1;
    TiXmlAttribute* pAttribute = xmlElement->FirstAttribute();
    SE_TextureCoordAnimation* anim = new SE_TextureCoordAnimation;
    while(pAttribute)
    {
        const char* name = pAttribute->Name();
        const char* value = pAttribute->Value();
        if(!strcmp(name, "FileName"))
        {
            anim->setImageDataID(value);
        }
        else if(!strcmp(name, "TimeMode"))
        {
            if(!strcmp(value, "SIMULATE_TIME"))
            {
                anim->setTimeMode(SE_Animation::SIMULATE);
            }
            else
            {
                anim->setTimeMode(SE_Animation::REAL);
            }

        }
        else if(!strcmp(name, "RunMode"))
        {
            if(!strcmp(value, "NOT_REPEAT"))
            {
                anim->setRunMode(SE_Animation::NOT_REPEAT);
            }
            else if(!strcmp(value, "REPEAT"))
            {
                anim->setRunMode(SE_Animation::REPEAT);
            }
            else if(!strcmp(value, "ONE_FRAME"))
            {
                anim->setRunMode(SE_Animation::ONE_FRAME);
            }
            else if(!strcmp(value, "REVERSE_NOT_REPEAT"))
            {
                anim->setRunMode(SE_Animation::REVERSE_NOT_REPEAT);
            }
            else if(!strcmp(value, "REVERSE_REPEAT"))
            {
                anim->setRunMode(SE_Animation::REVERSE_REPEAT);
            }
            else if(!strcmp(value, "REVERSE_ONE_FRAME"))
            {
                anim->setRunMode(SE_Animation::REVERSE_ONE_FRAME);
            }
        }
        else if(!strcmp(name, "Duration"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                anim->setDuration(ival);
            }
            else
            {
                LOGI("...parse animation duration error\n");
            }
        }
        pAttribute = pAttribute->Next();
    }
    parent->setAnimation(anim);
    TiXmlNode* currNode = xmlElement;
    TiXmlNode* childNode = NULL;
    for(childNode = currNode->FirstChild() ; childNode != NULL; childNode = childNode->NextSibling())
    {
        elementManager->handleXmlChild(parent, childNode, indent + 1);
    }
}
示例#20
0
void SE_ElementHandler::handle(SE_Element* parent, TiXmlElement* xmlElement, unsigned int indent)
{
    if(!xmlElement)
        return;
    TiXmlAttribute* pAttribute = xmlElement->FirstAttribute();
    SE_Element* element = new SE_Element;
    if(parent)
    {
        parent->addChild(element);
        element->setParent(parent);
    }
    else
    {
        element->setParent(NULL);
        elementManager->setRoot(element);
    }
    bool hasLayer = false;
    while(pAttribute)
    {
        const char* name = pAttribute->Name();
        const char* value = pAttribute->Value();
        int ival = -1;
        if(!strcmp(name, "id"))
        {
            element->setID(value);
        }
        else if(!strcmp(name, "x"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                element->setLeft(ival);
            }
            else
            {
                LOGI("... parse x value error\n");
            }
        }
        else if(!strcmp(name, "y"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                element->setTop(ival);
            }
            else
            {
                LOGI("... parse y value error\n");
            }
        }
        else if(!strcmp(name, "width"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                element->setWidth(ival);
            }
            else
            {
                LOGI("... parse width value error\n");
            }
        }
        else if(!strcmp(name, "height"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                element->setHeight(ival);
            }
            else
            {
                LOGI("... parse height value error\n");
            }
        }
        else if(!strcmp(name, "layer"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                element->setLocalLayer(ival);
            }
            else
            {
                LOGI("... parse layer value error\n");
            }
            hasLayer = true;
        }
        else if(!strcmp(name, "pivotx"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                element->setPivotX(ival);
            }
            else
            {
                LOGI("... parse pivotx value error\n");
            }
        }
        else if(!strcmp(name, "pivoty"))
        {
            if(pAttribute->QueryIntValue(&ival) == TIXML_SUCCESS)
            {
                element->setPivotY(ival);
            }
            else
            {
                LOGI("... parse pivoty value error\n");
            }
        }
        pAttribute = pAttribute->Next();
    }
    if(!hasLayer)
    {
        element->setLocalLayer(indent);
    }
    TiXmlNode* currNode = xmlElement;
    TiXmlNode* pChild = NULL;
    for(pChild = currNode->FirstChild() ; pChild != NULL ; pChild = pChild->NextSibling())
    {
        elementManager->handleXmlChild(element, pChild, indent + 1);
    }
}