VR-Forces 4.0.4 Class Documentation
include/vrvTerrain/DtMetaFlightParser.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2010 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile:  $ $Revision:  $ $State:  $
00007 ******************************************************************************/
00008 
00012 
00013 #pragma once
00014 #include <vrvTerrain/vrvTerrain.h>
00015 #include <libxml/tree.h>
00016 #include <string>
00017 
00018 namespace makVrv
00019 {
00022    class DT_DLL_VRVTERRAIN DtMetaFlightParser
00023    {
00024    public:
00025 
00027       DtMetaFlightParser();
00028 
00030       bool openFile(const std::string& fileName,
00031          const std::string& virtualTextureFilename, std::string& parseError);
00032 
00034       const std::string& fileName() const;
00035 
00039       const std::string& virtualTextureFileName() const;
00040 
00043       static bool publish( const std::string& fileName, 
00044          const std::string& virtualTextureFilename, 
00045          const std::string& outputFileName,          
00046          bool encryptingData, bool removeVT, std::string& parseError,
00047          bool extendGridLevelZero, float extendGridLevelZeroTo);
00048 
00050       const char* currentElementType() const;
00051 
00053       const char* currentElementName() const;
00054 
00056       const char* currentElementReference() const;
00057 
00060       std::string currentElementNameOrGenerateUnique();
00061 
00063       const char* currentElementText() const;
00064 
00066       bool getCurrentElementValue(std::string& value) const;
00067 
00069       bool getCurrentElementValue(int& value) const;
00070 
00072       bool getCurrentElementValue(unsigned int& value) const;
00073 
00075       bool getCurrentElementValue(double& value) const;
00076      
00078       unsigned int numberOfChildElements() const;
00079       
00082       bool readFirstChildElement();
00083       
00085       bool readNextElement();
00086 
00088       bool readPreviousElement();
00089 
00091       bool readParentElement();
00092 
00093    protected:
00094 
00095       static xmlDocPtr createDocument( const std::string& file, 
00096          std::string& parseError );
00097       
00098       static int countChildrenWithName( xmlNodePtr node, 
00099          const std::string& nodeName );
00100 
00101       static xmlNodePtr findChildWithName( const xmlNodePtr node, 
00102          const std::string& nodeName, const int occurance = 0);
00103 
00104       static void replaceAll( std::string& result, 
00105          const std::string& replaceWhat, const std::string& replaceWithWhat );
00106 
00107       static xmlNodePtr findDatabaseNode( xmlDocPtr xmlDocument, 
00108          std::string& parseError );
00109 
00110       static xmlNodePtr findChildWithAttribute( xmlNodePtr node, 
00111          const std::string& nodeName, const std::string& attrName, 
00112          const std::string& attrValue );
00113 
00114       static const char* attribute( xmlNodePtr node, 
00115          const std::string& attrName );
00116 
00117       static const char* text(xmlNodePtr node);
00118 
00119       static bool setText( xmlNodePtr node,const std::string& text );
00120      
00121    protected:
00122 
00123       std::string myFileName;
00124       std::string myVirtualTextureFileName;
00125 
00126       xmlDocPtr myDocument;
00127       xmlNodePtr myCurrentNode;
00128       unsigned int myUniqueId;
00129    };
00130 }
00131 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)