本文整理汇总了C++中xml::Attribute::AsReal方法的典型用法代码示例。如果您正苦于以下问题:C++ Attribute::AsReal方法的具体用法?C++ Attribute::AsReal怎么用?C++ Attribute::AsReal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml::Attribute
的用法示例。
在下文中一共展示了Attribute::AsReal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.");
}
}
示例2: Name_
ConeCollisionShape::ConeCollisionShape(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(Exception::PARAMETERS_EXCEPTION,"Could not find Name Attribute on CollsionShape Node during preparation for deserialization"); }
String Name_(OneName.AsString());
XML::Attribute Radius = OneNode.GetAttribute("Radius"); // Find Attributes
if (!Radius) { DeSerializeError("find Radius Attribute",ConeCollisionShape::SerializableName()); }
XML::Attribute Axis = OneNode.GetAttribute("Axis");
if (!Axis) { DeSerializeError("find Axis Attribute",ConeCollisionShape::SerializableName()); }
XML::Attribute Height = OneNode.GetAttribute("Height");
if (!Height) { DeSerializeError("find Height Attribute",ConeCollisionShape::SerializableName()); }
this->Construct(Name_,Radius.AsReal(),Height.AsReal(), (StandardAxis)Axis.AsInteger()); // make and deserialize the shape
this->ProtoDeSerialize(OneNode);
}else{
DeSerializeError("find usable serialization version",ConeCollisionShape::SerializableName());
}
}