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


C++ Attribute::AsBool方法代码示例

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


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

示例1: ProtoDeSerializeProperties

        void SliderConstraint::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
        {
            this->Constraint::ProtoDeSerializeProperties(SelfRoot);

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

            if( !PropertiesNode.Empty() ) {
                if( PropertiesNode.GetAttribute("Version").AsInt() == 1 ) {
                    CurrAttrib = PropertiesNode.GetAttribute("UseFrameOffset");
                    if( !CurrAttrib.Empty() )
                        this->SetUseFrameOffset( CurrAttrib.AsBool() );

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

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

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

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

                    CurrAttrib = PropertiesNode.GetAttribute("PoweredLinMotor");
                    if( !CurrAttrib.Empty() )
                        this->SetPoweredLinMotor( CurrAttrib.AsBool() );

                    CurrAttrib = PropertiesNode.GetAttribute("PoweredAngMotor");
                    if( !CurrAttrib.Empty() )
                        this->SetPoweredAngMotor( CurrAttrib.AsBool() );

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

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

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

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

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

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

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

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


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