本文整理汇总了C++中TiXmlAttribute::QueryIntValue方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlAttribute::QueryIntValue方法的具体用法?C++ TiXmlAttribute::QueryIntValue怎么用?C++ TiXmlAttribute::QueryIntValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlAttribute
的用法示例。
在下文中一共展示了TiXmlAttribute::QueryIntValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read_Bus
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: dump_attribs_to_stdout
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;
}
示例3: Read_Bus_Aux
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: QueryIntAttribute
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:
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;
}
示例6: Read_Master_Insert
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);
}
示例7: GetInterfaceAttributes
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) ;
}
示例8: ReadXML
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++;
}
}
示例9: Output_attributes
//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;
}
示例10: ParseWire
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 ;
}
示例11: Parse_Project_Info
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);
}
}
示例12: ParseRouter
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: ReadXML
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 )
//.........这里部分代码省略.........
示例14: if
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 )
//.........这里部分代码省略.........
示例15: Read_Track_Insert
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);
}
}