本文整理汇总了C++中xml::Node::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::Empty方法的具体用法?C++ Node::Empty怎么用?C++ Node::Empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml::Node
的用法示例。
在下文中一共展示了Node::Empty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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.");
}
}
示例2: 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.");
}
}
}
示例3: 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.");
}
}
示例4: LoadAtlasFromFile
void TextureAtlasHandler::LoadAtlasFromFile(const String& Name, const String& Group)
{
/// @todo Update after we have refactored the resource system if needed.
Resource::DataStreamPtr AtlasStream = Resource::ResourceManager::GetSingletonPtr()->OpenAssetStream(Name,Group);
AtlasStream->SetStreamPosition(0);
XML::Document AtlasDoc;
AtlasDoc.Load( *AtlasStream.Get() );
XML::Node RootNode = AtlasDoc.GetChild("Atlases");
if( !RootNode.Empty() )
{
for( XML::NodeIterator AtlasIt = RootNode.begin() ; AtlasIt != RootNode.end() ; ++AtlasIt )
{
// Parse the Atlas
TextureAtlas* NewAtlas = new TextureAtlas( (*AtlasIt) );
// Verify we don't already have one of the same name
AtlasIterator AtIt = this->Atlases.find( NewAtlas->GetName() );
if( AtIt != Atlases.end() )
{
MEZZ_EXCEPTION(ExceptionBase::II_DUPLICATE_IDENTITY_EXCEPTION,"Texture Atlas with the name \"" + NewAtlas->GetName() + "\" already exists.");
}
// Add the unique Atlas
this->Atlases[NewAtlas->GetName()] = NewAtlas;
}
}else{
MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"Mezzanine Texture Atlas file \"" + Name + "\"does not contain expected \"Atlases\" root node. File is not valid and cannot be parsed.");
}
}
示例5: 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.");
}
}
}
示例6: LoadAllShapesFromXMLFile
void CollisionShapeManager::LoadAllShapesFromXMLFile(const String& FileName, const String& Group)
{
/// @todo Replace this stack allocated stream for one initialized from the Resource Manager, after the system is ready.
Resource::FileStream ShapesStream( FileName, Resource::ResourceManager::GetSingletonPtr()->GetAssetPath(FileName,Group) );
XML::Document ShapesDoc;
XML::ParseResult DocResult = ShapesDoc.Load(ShapesStream);
if( DocResult.Status != XML::StatusOk ) {
MEZZ_EXCEPTION(ExceptionBase::SYNTAX_ERROR_EXCEPTION_XML,"Failed to parse XML file \"" + FileName + "\".");
}
XML::Node ShapesRoot = ShapesDoc.GetChild("InitializerRoot");
if( ShapesRoot.Empty() ) {
MEZZ_EXCEPTION(ExceptionBase::SYNTAX_ERROR_EXCEPTION_XML,"Failed to find expected Root node in \"" + FileName + "\".");
}
for( XML::NodeIterator ShapeIt = ShapesRoot.begin() ; ShapeIt != ShapesRoot.end() ; ++ShapeIt )
{
CollisionShape* DeSerializedShape = Physics::CreateShape( (*ShapeIt) );
this->CollisionShapes.insert( std::pair<String,CollisionShape*>(DeSerializedShape->GetName(),DeSerializedShape) );
}
}
示例7: 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.");
}
}
}
示例8: 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.");
}
}
}
示例9: ConstructFromXML
void Entresol::ConstructFromXML(const String& EngineDataPath, const Mezzanine::ArchiveType ArchType, const String& InitializerFile)
{
//Add default manager factories
AddAllEngineDefaultManagerFactories();
//Set some sane Defaults for some values.
this->ManualLoopBreak = false;
// Create Ogre.
SetupOgre();
// Load the necessary plugins.
SubSystemParticleFXPlugin = new Ogre::ParticleFXPlugin();
Ogre::Root::getSingleton().installPlugin(SubSystemParticleFXPlugin);
// Set up the data we'll be populating.
XML::Attribute CurrAttrib;
String GUIInit, ResourceInit, PluginsInit, LogFileName;
String PluginExtension, PluginPath;
// Create or set the resource manager.
/// @todo This currently forces our default resource manager to be constructed, which isn't in line with our factory/initiailzation design.
/// This should be addressed somehow.
if(ResourceManager::SingletonValid())
{ AddManager(ResourceManager::GetSingletonPtr()); }
else
{ AddManager(new ResourceManager(EngineDataPath, ArchType)); }
// Open and load the initializer doc.
ResourceManager* ResourceMan = GetResourceManager();
/// @todo Replace this stack allocated stream for one initialized from the Resource Manager, after the system is ready.
Resource::FileStream InitStream(InitializerFile,EngineDataPath);
XML::Document InitDoc;
XML::ParseResult DocResult = InitDoc.Load(InitStream);
if( DocResult.Status != XML::StatusOk )
{
StringStream ExceptionStream;
ExceptionStream << "Failed to parse XML file \"" << InitializerFile << "\".";
MEZZ_EXCEPTION(Exception::SYNTAX_ERROR_EXCEPTION_XML,ExceptionStream.str());
}
XML::Node InitRoot = InitDoc.GetChild("InitializerRoot");
if( InitRoot.Empty() )
{
StringStream ExceptionStream;
ExceptionStream << "Failed to find expected Root node in \"" << InitializerFile << "\".";
MEZZ_EXCEPTION(Exception::SYNTAX_ERROR_EXCEPTION_XML,ExceptionStream.str());
}
// Get the world settings and set them.
XML::Node WorldSettings = InitRoot.GetChild("WorldSettings");
for( XML::NodeIterator SetIt = WorldSettings.begin() ; SetIt != WorldSettings.end() ; ++SetIt )
{
String SecName = (*SetIt).Name();
if( "FrameSettings" == SecName )
{
CurrAttrib = (*SetIt).GetAttribute("TargetFrameRate");
if(CurrAttrib.Empty())
{
CurrAttrib = (*SetIt).GetAttribute("TargetFrameTime");
if(!CurrAttrib.Empty())
SetTargetFrameTimeMicroseconds(CurrAttrib.AsWhole());
}else{
this->SetTargetFrameRate(CurrAttrib.AsWhole());
}
}
else
{
MEZZ_EXCEPTION(Exception::SYNTAX_ERROR_EXCEPTION_XML,String("Unknown WorldSetting ")+SecName);
}
}
SetupLogging(LogFileName);
// Get the other initializer files we'll be using, since we'll need the plugins initializer.
XML::Node InitFiles = InitRoot.GetChild("OtherInitializers");
for( XML::NodeIterator InitIt = InitFiles.begin() ; InitIt != InitFiles.end() ; ++InitIt )
{
String InitFileName = (*InitIt).Name();
if( "PluginInit" == InitFileName )
{
CurrAttrib = (*InitIt).GetAttribute("FileName");
if(!CurrAttrib.Empty())
PluginsInit = CurrAttrib.AsString();
}
else if( "ResourceInit" == InitFileName )
{
CurrAttrib = (*InitIt).GetAttribute("FileName");
if(!CurrAttrib.Empty())
ResourceInit = CurrAttrib.AsString();
}
else if( "GUIInit" == InitFileName )
{
CurrAttrib = (*InitIt).GetAttribute("FileName");
if(!CurrAttrib.Empty())
GUIInit = CurrAttrib.AsString();
}
}
// Load additional resource groups
/*if(!ResourceInit.empty())
//.........这里部分代码省略.........