本文整理汇总了C++中xml::Attribute类的典型用法代码示例。如果您正苦于以下问题:C++ Attribute类的具体用法?C++ Attribute怎么用?C++ Attribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Attribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProtoDeSerializeCustomParameters
void ParticleAffector::ProtoDeSerializeCustomParameters(const XML::Node& SelfRoot)
{
XML::Attribute CurrAttrib;
XML::Node CustomParametersNode = SelfRoot.GetChild( ParticleAffector::GetSerializableName() + "CustomParameters" );
if( !CustomParametersNode.Empty() ) {
if(CustomParametersNode.GetAttribute("Version").AsInt() == 1) {
String ParamName, ParamValue;
for( XML::NodeIterator ParamIt = CustomParametersNode.begin() ; ParamIt != CustomParametersNode.end() ; ++ParamIt )
{
if( !(*ParamIt).Empty() ) {
if((*ParamIt).GetAttribute("Version").AsInt() == 1) {
CurrAttrib = (*ParamIt).GetAttribute("ParamName");
if( !CurrAttrib.Empty() )
ParamName = CurrAttrib.AsString();
CurrAttrib = (*ParamIt).GetAttribute("ParamValue");
if( !CurrAttrib.Empty() )
ParamValue = CurrAttrib.AsString();
if( !ParamName.empty() && !ParamValue.empty() ) {
this->SetCustomParam(ParamName,ParamValue);
}
}
}
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (ParticleAffector::GetSerializableName() + "CustomParameters" ) + ": Not Version 1.");
}
}else{
MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,ParticleAffector::GetSerializableName() + "CustomParameters" + " was not found in the provided XML node, which was expected.");
}
}
示例2: Name_
CapsuleCollisionShape::CapsuleCollisionShape(XML::Node OneNode)
{
if(OneNode.GetAttribute("Version").AsInt() == 1)
{
XML::Attribute OneName = OneNode.GetChild("PrimitiveCollisionShape").GetChild("CollisionShape").GetAttribute("Name"); // get name
if(!OneName) {
MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Could not find Name Attribute on CollsionShape Node during preparation for deserialization");
}
String Name_(OneName.AsString());
XML::Attribute Axis = OneNode.GetAttribute("Axis");
if (!Axis) {
DeSerializeError("find Axis Attribute",CapsuleCollisionShape::GetSerializableName());
}
/*
XML::Attribute Radius = OneNode.GetAttribute("Radius");
if (!Radius) { DeSerializeError("find Radius Attribute",CapsuleCollisionShape::GetSerializableName()); }
XML::Attribute Height = OneNode.GetAttribute("Height");
if (!Height) { DeSerializeError("find Height Attribute",CapsuleCollisionShape::GetSerializableName()); }
//SetPointers(new CapsuleCollisionShape(Name_,Radius.AsReal(),Height.AsReal(), (StandardAxis)Axis.AsInteger()); // make and deserialize the shape
this->Construct(Name_,Radius.AsReal(),Height.AsReal(),(StandardAxis)Axis.AsInteger());
*/
this->Construct(Name_,0,0,(StandardAxis)Axis.AsInteger());
this->ProtoDeSerialize(OneNode);
} else {
DeSerializeError("find usable serialization version",CapsuleCollisionShape::GetSerializableName());
}
}
示例3: ProtoSerialize
void GearConstraint::ProtoSerialize(XML::Node& CurrentRoot) const
{
XML::Node P2PNode = CurrentRoot.AppendChild(this->GearConstraint::SerializableName()); // The base node all the base constraint stuff will go in
if (!P2PNode)
{ SerializeError("Create P2PNode", SerializableName()); }
XML::Attribute VerAttr = P2PNode.AppendAttribute("Version");
XML::Attribute RatioAttr = P2PNode.AppendAttribute("Ratio");
if( VerAttr && RatioAttr )
{
VerAttr.SetValue(1);
RatioAttr.SetValue(this->GetRotationRatio());
}else{
SerializeError("Create P2PNode Attributes", SerializableName());
}
XML::Node ActorANode = P2PNode.AppendChild("ActorA");
if (!ActorANode)
{ SerializeError("Create ActorANode", SerializableName()); }
this->GetAxisA().ProtoSerialize(ActorANode);
XML::Node ActorBNode = P2PNode.AppendChild("ActorB");
if (!ActorBNode)
{ SerializeError("Create ActorBNode", SerializableName()); }
this->GetAxisB().ProtoSerialize(ActorBNode);
this->Constraint::ProtoSerialize(P2PNode);
}
示例4: ProtoSerialize
void NonStaticWorldObject::ProtoSerialize(XML::Node& CurrentRoot) const
{
XML::Node NonStaticWorldObjectNode = CurrentRoot.AppendChild("NonStaticWorldObject");
if (!NonStaticWorldObjectNode) { ThrowSerialError("create NonStaticWorldObjectNode");}
XML::Attribute Version = NonStaticWorldObjectNode.AppendAttribute("Version");
Version.SetValue(1);
XML::Node OrientationNode = NonStaticWorldObjectNode.AppendChild("Orientation");
if(!OrientationNode) { ThrowSerialError("create OrientationNode"); }
this->GetOrientation().ProtoSerialize(OrientationNode);
// if actor node is in scenemanager just save a name
/*if( Entresol::GetSingletonPtr()->GetSceneManager()->GetNode( this->ObjectWorldNode->GetName() ) )
{
XML::Attribute NonStaticWorldObjectNodeAttrib = NonStaticWorldObjectNode.AppendAttribute("WorldNode");
if(!NonStaticWorldObjectNodeAttrib.SetValue(this->ObjectWorldNode->GetName()))
{ThrowSerialError("store WorldNode Name");}
}else{
SloppyProtoSerialize( *(this->ObjectWorldNode),NonStaticWorldObjectNode); //Serialization performed in older style
}// */
WorldObject::ProtoSerialize(NonStaticWorldObjectNode);
}
示例5: ProtoDeSerializeEvents
void Widget::ProtoDeSerializeEvents(const XML::Node& SelfRoot)
{
this->RemoveAllEvents();
XML::Attribute CurrAttrib;
XML::Node EventsNode = SelfRoot.GetChild( "Events" );
if( !EventsNode.Empty() ) {
if( EventsNode.GetAttribute("Version").AsInt() == 1 ) {
for( XML::NodeIterator EvNodeIt = EventsNode.begin() ; EvNodeIt != EventsNode.end() ; ++EvNodeIt )
{
if( (*EvNodeIt).GetAttribute("Version").AsInt() == 1 ) {
String EvName;
CurrAttrib = (*EvNodeIt).GetAttribute("Name");
if( !CurrAttrib.Empty() )
EvName = CurrAttrib.AsString();
if( !EvName.empty() ) {
this->AddEvent(EvName);
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("Events") + ": Not Version 1.");
}
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("Events") + ": Not Version 1.");
}
}
}
示例6: ProtoDeSerializeProperties
void WorldProxy::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
{
XML::Attribute CurrAttrib;
XML::Node PropertiesNode = SelfRoot.GetChild( WorldProxy::GetSerializableName() + "Properties" );
if( !PropertiesNode.Empty() ) {
if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
CurrAttrib = PropertiesNode.GetAttribute("ProxyID");
if( !CurrAttrib.Empty() )
this->ProxyID = static_cast<UInt32>( CurrAttrib.AsUint() );
XML::Node PositionNode = PropertiesNode.GetChild("Location").GetFirstChild();
if( !PositionNode.Empty() ) {
Vector3 Loc(PositionNode);
this->SetLocation(Loc);
}
XML::Node OrientationNode = PropertiesNode.GetChild("Orientation").GetFirstChild();
if( !PositionNode.Empty() ) {
Quaternion Rot(OrientationNode);
this->SetOrientation(Rot);
}
XML::Node ScaleNode = PropertiesNode.GetChild("Scale").GetFirstChild();
if( !PositionNode.Empty() ) {
Vector3 Scale(ScaleNode);
this->SetScale(Scale);
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (WorldProxy::GetSerializableName() + "Properties" ) + ": Not Version 1.");
}
}else{
MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,WorldProxy::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
}
}
示例7: ProtoSerialize
void CapsuleCollisionShape::ProtoSerialize(XML::Node& CurrentRoot) const
{
XML::Node CollisionNode = CurrentRoot.AppendChild(this->CapsuleCollisionShape::SerializableName());
if (!CollisionNode) { SerializeError("create CollisionNode",this->CapsuleCollisionShape::SerializableName());}
XML::Attribute Version = CollisionNode.AppendAttribute("Version");
if (Version)
{ Version.SetValue(1); }
else
{ SerializeError("Create Version Attribute", SerializableName()); }
/*
XML::Attribute RadiusAttr = CollisionNode.AppendAttribute("Radius");
if (RadiusAttr)
{ RadiusAttr.SetValue(this->GetCleanRadius()); }
else
{ SerializeError("Create RadiusAttr Attribute", SerializableName()); }
XML::Attribute HeightAttr = CollisionNode.AppendAttribute("Height");
if (HeightAttr)
{ HeightAttr.SetValue(this->GetCleanHeight()); }
else
{ SerializeError("Create HeightAttr Attribute", SerializableName()); }
*/
XML::Attribute AxisAttr = CollisionNode.AppendAttribute("Axis");
if (AxisAttr)
{ AxisAttr.SetValue(this->GetUpStandardAxis()); }
else
{ SerializeError("Create AxisAttr Attribute", SerializableName()); }
this->PrimitiveCollisionShape::ProtoSerialize(CollisionNode);
}
示例8: ProtoSerialize
void AreaEffect::ProtoSerialize(XML::Node& CurrentRoot) const
{
XML::Node AreaEffectNode = CurrentRoot.AppendChild("AreaEffect");
if (!AreaEffectNode) { ThrowSerialError("create AreaEffectNode");}
XML::Attribute AreaEffectVersion = AreaEffectNode.AppendAttribute("Version");
AreaEffectVersion.SetValue(1);
NonStaticWorldObject::ProtoSerialize(AreaEffectNode);
}
示例9: ProtoSerialize
void ActorRigid::ProtoSerialize(XML::Node& CurrentRoot) const
{
XML::Node ActorNode = CurrentRoot.AppendChild("ActorRigid");
if (!ActorNode) { ThrowSerialError("create ActorRigidNode");}
XML::Attribute Version = ActorNode.AppendAttribute("Version");
if (Version)
{ Version.SetValue(1); }
else
{ SerializeError("Create set Version on ActorRigid node", SerializableName()); }
XML::Attribute ActorName = ActorNode.AppendAttribute("Name");
ActorName.SetValue(this->GetName());
XML::Attribute ActorFile = ActorNode.AppendAttribute("File");
ActorFile.SetValue(this->GraphicsObject->getMesh()->getName());
XML::Attribute ActorGroup = ActorNode.AppendAttribute("Group");
ActorGroup.SetValue(this->GraphicsObject->getMesh()->getGroup());
if( !(ActorName && ActorFile && ActorGroup) )
{ ThrowSerialError("creating ActorRigid Attributes");}
XML::Node LinearMovementFactor = ActorNode.AppendChild("LinearMovementFactor");
if (!LinearMovementFactor) { ThrowSerialError("create LinearMovementFactor Node"); }
this->GetLinearMovementFactor().ProtoSerialize(LinearMovementFactor);
XML::Node AngularMovementFactor = ActorNode.AppendChild("AngularMovementFactor");
if (!AngularMovementFactor) { ThrowSerialError("create AngularMovementFactor Node"); }
this->GetAngularMovementFactor().ProtoSerialize(AngularMovementFactor);
ActorBase::ProtoSerialize(ActorNode);
}
示例10: ProtoDeSerialize
void WorldProxy::ProtoDeSerialize(const XML::Node& SelfRoot)
{
Boole WasInWorld = false;
XML::Attribute InWorldAttrib = SelfRoot.GetAttribute("InWorld");
if( !InWorldAttrib.Empty() ) {
WasInWorld = StringTools::ConvertToBool( InWorldAttrib.AsString() );
}
this->ProtoDeSerializeImpl(SelfRoot);
if( WasInWorld ) {
this->AddToWorld();
}
}
示例11: ProtoSerialize
void MeshCollisionShape::ProtoSerialize(XML::Node& CurrentRoot) const
{
XML::Node CollisionNode = CurrentRoot.AppendChild(this->MeshCollisionShape::GetSerializableName());
if (!CollisionNode) { SerializeError("create CollisionNode",this->MeshCollisionShape::GetSerializableName());}
XML::Attribute Version = CollisionNode.AppendAttribute("Version");
if (Version)
{ Version.SetValue(1); }
else
{ SerializeError("Create Version Attribute", GetSerializableName()); }
this->CollisionShape::ProtoSerialize(CollisionNode);
}
示例12: ProtoDeSerializeButtonBindings
void TabSet::ProtoDeSerializeButtonBindings(const XML::Node& SelfRoot)
{
this->SubSetBindings.clear();
XML::Attribute CurrAttrib;
XML::Node BindingsNode = SelfRoot.GetChild( "SubSetBindings" );
if( !BindingsNode.Empty() ) {
if( BindingsNode.GetAttribute("Version").AsInt() == 1 ) {
for( XML::NodeIterator BindingNodeIt = BindingsNode.begin() ; BindingNodeIt != BindingsNode.end() ; ++BindingNodeIt )
{
if( (*BindingNodeIt).GetAttribute("Version").AsInt() == 1 ) {
UInt16 ConfigID = 0;
String ButtonName;
CurrAttrib = (*BindingNodeIt).GetAttribute("ConfigID");
if( !CurrAttrib.Empty() )
ConfigID = static_cast<UInt16>( CurrAttrib.AsUint() );
CurrAttrib = (*BindingNodeIt).GetAttribute("ButtonName");
if( !CurrAttrib.Empty() )
ButtonName = CurrAttrib.AsString();
if( !ButtonName.empty() ) {
Widget* NamedButton = this->ParentScreen->GetWidget(ButtonName);
if( NamedButton != NULL && NamedButton->GetTypeName() == StackButton::TypeName ) {
this->SetButtonConfig(ConfigID,static_cast<StackButton*>(NamedButton));
}else{
StringStream ExceptionStream;
ExceptionStream << "Named StackButton \"" << ButtonName << "\" not found when deserializing Widget named \"" << this->GetName() << "\".";
MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,ExceptionStream.str());
}
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("SubSetBindings") + ": Not Version 1.");
}
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("SubSetBindings") + ": Not Version 1.");
}
}
}
示例13: SaveShapesToXMLFile
void CollisionShapeManager::SaveShapesToXMLFile(const String& FileName, ShapeVector& ShapesToSave)
{
XML::Document ShapesDoc;
XML::Node DeclNode = ShapesDoc.AppendChild(XML::NodeDeclaration);
XML::Attribute VerAttrib = DeclNode.AppendAttribute("version");
if( DeclNode.SetName("xml") && VerAttrib.SetValue("1.0") ) {
XML::Node ShapesRoot = ShapesDoc.AppendChild( "ShapesRoot" );
for( ShapeVectorIterator ShapeIt = ShapesToSave.begin() ; ShapeIt != ShapesToSave.end() ; ++ShapeIt )
{
(*ShapeIt)->ProtoSerialize( ShapesRoot );
}
/// @todo Replace this stack allocated stream for one initialized from the Resource Manager, after the system is ready.
Resource::FileStream SettingsStream(FileName,".",Resource::SF_Truncate | Resource::SF_Write);
ShapesDoc.Save(SettingsStream,"\t",XML::FormatIndent);
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"Failed to create XML document declaration for file \"" + FileName + "\".");
}
}
示例14: ProtoDeSerializeStateGroupBindings
void Widget::ProtoDeSerializeStateGroupBindings(const XML::Node& SelfRoot)
{
this->StateGroupBindings.clear();
XML::Attribute CurrAttrib;
XML::Node BindingsNode = SelfRoot.GetChild( "StateGroupBindings" );
if( !BindingsNode.Empty() ) {
if( BindingsNode.GetAttribute("Version").AsInt() == 1 ) {
for( XML::NodeIterator BindingNodeIt = BindingsNode.begin() ; BindingNodeIt != BindingsNode.end() ; ++BindingNodeIt )
{
if( (*BindingNodeIt).GetAttribute("Version").AsInt() == 1 ) {
UInt32 StateID = 0;
CurrAttrib = (*BindingNodeIt).GetAttribute("StateID");
if( !CurrAttrib.Empty() )
StateID = CurrAttrib.AsUint();
CurrAttrib = (*BindingNodeIt).GetAttribute("LayerGroupID");
if( !CurrAttrib.Empty() ) {
UInt16 LayerGroupID = CurrAttrib.AsUint();
RenderLayerGroup* NamedGroup = this->GetRenderLayerGroup( LayerGroupID );
if( NamedGroup != NULL ) {
this->StateGroupBindings.insert( std::pair<UInt32,RenderLayerGroup*>(StateID,NamedGroup) );
}else{
StringStream ExceptionStream;
ExceptionStream << "Named RenderLayerGroup \"" << LayerGroupID << "\" not found when deserializing Widget named \"" << this->GetName() << "\".";
MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,ExceptionStream.str());
}
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("StateGroupBindings") + ": Not Version 1.");
}
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("StateGroupBindings") + ": Not Version 1.");
}
}
}
示例15: ProtoDeSerializeGroupButtons
void RadioButton::ProtoDeSerializeGroupButtons(const XML::Node& SelfRoot)
{
this->RemoveFromButtonGroup();
XML::Attribute CurrAttrib;
XML::Node ButtonsNode = SelfRoot.GetChild( "GroupButtons" );
if( !ButtonsNode.Empty() ) {
if( ButtonsNode.GetAttribute("Version").AsInt() == 1 ) {
for( XML::NodeIterator ButtonNodeIt = ButtonsNode.begin() ; ButtonNodeIt != ButtonsNode.end() ; ++ButtonNodeIt )
{
if( (*ButtonNodeIt).GetAttribute("Version").AsInt() == 1 ) {
String GroupButtonName;
CurrAttrib = (*ButtonNodeIt).GetAttribute("GroupButtonName");
if( !CurrAttrib.Empty() )
GroupButtonName = CurrAttrib.AsString();
if( !GroupButtonName.empty() ) {
Widget* NamedButton = this->ParentScreen->GetWidget(GroupButtonName);
if( NamedButton != NULL && NamedButton->GetTypeName() == RadioButton::TypeName ) {
this->AddToButtonGroup( static_cast<RadioButton*>( NamedButton ) );
}else{
StringStream ExceptionStream;
ExceptionStream << "Named Widget \"" << GroupButtonName << "\" not found or not a RadioButton when deserializing Widget named \"" << this->GetName() << "\".";
MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,ExceptionStream.str());
}
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("GroupButtons") + ": Not Version 1.");
}
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("GroupButtons") + ": Not Version 1.");
}
}
}