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


C++ Node::GetAttribute方法代码示例

本文整理汇总了C++中xml::Node::GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::GetAttribute方法的具体用法?C++ Node::GetAttribute怎么用?C++ Node::GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml::Node的用法示例。


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

示例1: ProtoDeSerializeProperties

    void GravityWell::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
    {
        this->AreaEffect::ProtoDeSerializeProperties(SelfRoot);

        XML::Attribute CurrAttrib;
        XML::Node PropertiesNode = SelfRoot.GetChild( GravityWell::GetSerializableName() + "Properties" );

        if( !PropertiesNode.Empty() ) {
            if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
                CurrAttrib = PropertiesNode.GetAttribute("AttenAmount");
                if( !CurrAttrib.Empty() )
                    this->SetAttenuationAmount( CurrAttrib.AsReal() );

                CurrAttrib = PropertiesNode.GetAttribute("AttenStyle");
                if( !CurrAttrib.Empty() )
                    this->SetAttenuationStyle( static_cast<Mezzanine::AttenuationStyle>( CurrAttrib.AsWhole() ) );

                CurrAttrib = PropertiesNode.GetAttribute("Strength");
                if( !CurrAttrib.Empty() )
                    this->SetFieldStrength( CurrAttrib.AsReal() );

                CurrAttrib = PropertiesNode.GetAttribute("AllowWorldGravity");
                if( !CurrAttrib.Empty() )
                    this->SetAllowWorldGravity( StringTools::ConvertToBool( CurrAttrib.AsString() ) );
            }else{
                MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (GravityWell::GetSerializableName() + "Properties" ) + ": Not Version 1.");
            }
        }else{
            MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,GravityWell::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
        }
    }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例2: ProtoDeSerialize

        void GearConstraint::ProtoDeSerialize(const XML::Node& OneNode)
        {
            if ( Mezzanine::String(OneNode.Name())==this->GearConstraint::SerializableName() )
            {
                if(OneNode.GetAttribute("Version").AsInt() == 1)
                {
                    this->Constraint::ProtoDeSerialize(OneNode.GetChild("Constraint"));

                    this->SetRotationRatio(OneNode.GetAttribute("Ratio").AsReal());

                    XML::Node ActorANode = OneNode.GetChild("ActorA");
                    if(!ActorANode)
                        { DeSerializeError("Could not find ActorA axis",SerializableName()); }

                    XML::Node ActorBNode = OneNode.GetChild("ActorB");
                    if(!ActorBNode)
                        { DeSerializeError("Could not find ActorB axis",SerializableName()); }

                    Vector3 temp;
                    temp.ProtoDeSerialize(ActorANode.GetFirstChild());
                    this->SetAxisA(temp);
                    temp.ProtoDeSerialize(ActorBNode.GetFirstChild());
                    this->SetAxisB(temp);
                }else{
                    DeSerializeError("find usable serialization version",SerializableName());
                }
            }else{
                DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName());
            }
        }
开发者ID:zester,项目名称:Mezzanine,代码行数:30,代码来源:gearconstraint.cpp

示例3: 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());
    }
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例4: ProtoDeSerialize

    void WorldObject::ProtoDeSerialize(const XML::Node& OneNode)
    {
        if ( Mezzanine::String(OneNode.Name())==this->WorldObject::SerializableName() )
        {
            if(OneNode.GetAttribute("Version").AsInt() == 1)
            {
                Vector3 TempVec;
                XML::Node LocationNode = OneNode.GetChild("Location").GetFirstChild();
                if(!LocationNode)
                    { DeSerializeError("locate Location node",SerializableName()); }
                TempVec.ProtoDeSerialize(LocationNode);
                this->SetLocation(TempVec);

                XML::Node GraphicsSettingsNode = OneNode.GetChild(this->GraphicsSettingsSerializableName());
                if(!GraphicsSettingsNode)
                    { DeSerializeError("locate Graphics Settings node",SerializableName()); }
                this->GetGraphicsSettings()->ProtoDeSerialize(GraphicsSettingsNode);

                XML::Node PhysicsSettingsNode = OneNode.GetChild(this->PhysicsSettingsSerializableName());
                if(!PhysicsSettingsNode)
                    { DeSerializeError(String("locate Physics Settings node, ")+this->PhysicsSettingsSerializableName()+", ",SerializableName()); }
                this->GetPhysicsSettings()->ProtoDeSerialize(PhysicsSettingsNode);

                XML::Node ScalingNode = OneNode.GetChild("Scaling").GetFirstChild();
                if(!ScalingNode)
                    { DeSerializeError("locate Scaling node",SerializableName()); }
                TempVec.ProtoDeSerialize(ScalingNode);
                this->SetScaling(TempVec);

                if( this->IsInWorld() != OneNode.GetAttribute("IsInWorld").AsBool() )
                {
                    if(this->IsInWorld())
                        { this->RemoveFromWorld(); }
                    else
                        { this->AddToWorld(); }
                }

                /*if( 0!=OneNode.GetAttribute("SoundSet") && ""!=OneNode.GetAttribute("SoundSet").AsString())
                    { this->ObjectSounds = Audio::AudioManager::GetSingletonPtr()->GetSoundSet(OneNode.GetAttribute("SoundSet").AsString()); }
                else
                    { this->ObjectSounds = 0; }//*/
            }else{
                DeSerializeError("find usable serialization version",SerializableName());
            }
        }else{
            DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName());
        }
    }
开发者ID:zester,项目名称:Mezzanine,代码行数:48,代码来源:worldobject.cpp

示例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.");
                }
            }
        }
开发者ID:,项目名称:,代码行数:30,代码来源:

示例6: ProtoDeSerialize

    void ActorRigid::ProtoDeSerialize(const XML::Node& OneNode)
    {
        if ( Mezzanine::String(OneNode.Name())==this->ActorRigid::SerializableName() )
        {
            if(OneNode.GetAttribute("Version").AsInt() == 1)
            {
                this->ActorBase::ProtoDeSerialize(OneNode.GetChild(this->ActorBase::SerializableName()));

                Vector3 TempVec;
                XML::Node LinearMovementFactor = OneNode.GetChild("LinearMovementFactor").GetFirstChild();
                if(!LinearMovementFactor)
                    { DeSerializeError("locate LinearMovementFactor node",SerializableName()); }
                TempVec.ProtoDeSerialize(LinearMovementFactor);
                this->SetLinearMovementFactor(TempVec);

                XML::Node AngularMovementFactor = OneNode.GetChild("AngularMovementFactor").GetFirstChild();
                if(!AngularMovementFactor)
                    { DeSerializeError("locate AngularMovementFactor node",SerializableName()); }
                TempVec.ProtoDeSerialize(AngularMovementFactor);
                this->SetAngularMovementFactor(TempVec);
                // could not do Name, File, Group - done in ActorDeSerializer
            }else{
                DeSerializeError("find usable serialization version",SerializableName());
            }
        }else{
            DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName());
        }
    }
开发者ID:zester,项目名称:Mezzanine,代码行数:28,代码来源:actorrigid.cpp

示例7: 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.");
            }
        }
开发者ID:,项目名称:,代码行数:34,代码来源:

示例8: ProtoDeSerialize

 // DeSerializable
 void ColourValue::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if( Mezzanine::String(OneNode.Name())==this->ColourValue::GetSerializableName() )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             this->RedChannel=OneNode.GetAttribute("Red").AsReal();
             this->GreenChannel=OneNode.GetAttribute("Green").AsReal();
             this->BlueChannel=OneNode.GetAttribute("Blue").AsReal();
             this->AlphaChannel=OneNode.GetAttribute("Alpha").AsReal();
         }else{
             MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (this->ColourValue::GetSerializableName()) + ": Not Version 1");
         }
     }else{
         MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_INVALID_EXCEPTION,"Attempting to deserialize a " + (this->ColourValue::GetSerializableName()) + ", found a " + OneNode.Name());
     }
 }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例9: ProtoDeSerialize

 void AreaEffect::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if ( Mezzanine::String(OneNode.Name())==this->AreaEffect::SerializableName() )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             NonStaticWorldObject::ProtoDeSerialize(OneNode.GetChild(this->NonStaticWorldObject::SerializableName()));
         }
     }
 }
开发者ID:zester,项目名称:Mezzanine,代码行数:10,代码来源:areaeffect.cpp

示例10: ProtoDeSerialize

 void Transform::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if ( Mezzanine::String(OneNode.Name())==Mezzanine::String(SerializableName()) )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             this->Location.ProtoDeSerialize(OneNode.GetChild("Vector3"));
             this->Rotation.ProtoDeSerialize(OneNode.GetChild("Quaternion"));
         }else{
             MEZZ_EXCEPTION(Exception::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + SerializableName() + ": Not Version 1.");
         }
     }else{
         MEZZ_EXCEPTION(Exception::II_IDENTITY_INVALID_EXCEPTION,"Attempting to deserialize a " + SerializableName() + ", found a " + String(OneNode.Name()));
     }
 }
开发者ID:zester,项目名称:Mezzanine,代码行数:15,代码来源:transform.cpp

示例11: ProtoDeSerialize

 void CapsuleCollisionShape::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if ( Mezzanine::String(OneNode.Name())==this->CapsuleCollisionShape::SerializableName() )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             XML::Node CollisionNode = OneNode.GetChild(this->PrimitiveCollisionShape::SerializableName());
             if(!CollisionNode)
                 { DeSerializeError("locate PrimitiveCollisionShape node",SerializableName()); }
             this->PrimitiveCollisionShape::ProtoDeSerialize(CollisionNode);
         }else{
             DeSerializeError("find usable serialization version",SerializableName());
         }
     }else{
         DeSerializeError(String("find correct class to deserialize, found a ")+OneNode.Name(),SerializableName());
     }
 }
开发者ID:zester,项目名称:Mezzanine,代码行数:17,代码来源:capsulecollisionshape.cpp

示例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.");
                }
            }
        }
开发者ID:,项目名称:,代码行数:42,代码来源:

示例13: 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.");
                }
            }
        }
开发者ID:,项目名称:,代码行数:39,代码来源:

示例14: 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.");
                }
            }
        }
开发者ID:,项目名称:,代码行数:37,代码来源:


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