VR-Forces 4.2 Class Documentation
List of all members | Public Types | Static Public Member Functions
DtXmlUtils Class Reference

Public Types

typedef std::list< DtEnvValueSP > DtEnvValueSPList
typedef std::list< DtStringStringVector
typedef std::vector
< DtReaderWriterRegistryData * > 
RegDataVector
typedef std::map< DtString,
DtString
GroupMappings
typedef std::list< DtStringNameList

Static Public Member Functions

static void getObjectElements (DtEnvironmentSP env, DtEnvValueSPList &objectNodes)
 XML Utility Functions.
static DtEnvValueSP findObjectElementByMatchType (DtEnvironmentSP env, const DtObjectType &objType)
 Finds an individual vrfXml::SimObject node by object type.
static DtEnvValueSP findObjectElementByObjectType (DtEnvironmentSP env, const DtObjectType &objType)
static DtString getAttribute (DtEnvironmentSP env, const DtString &name, DtEnvValueSP root)
 Gets the named attribute from a DtEnvValueSP.
static bool hasAttribute (DtEnvironmentSP env, const DtString &name, DtEnvValueSP root)
 Returns true if the attribute exists.
static bool FindAndRemove (DtEnvironmentSP env, const DtString &nodeType, const DtString &paramName, DtEnvValueSP root)
static void remove (DtEnvironmentSP, DtEnvValueSP)
 Removes a value from the environment. Use this routine rather than the VR-Link remove routine.
static DtString getPlatform (DtEnvironmentSP env, DtEnvValueSP root)
 Gets platform attribute from current Node.
static DtString GetObjectValue (DtEnvValueSP root)
static DtEnvValueSP AddElement (DtEnvironmentSP env, const DtString &type, DtEnvValueSP root, const DtString &paramName=DtString::nullString())
static DtEnvValueSP addbooleanElement (DtEnvironmentSP env, DtEnvValueSP root, const DtString &name, bool value)
 Adds a new boolean type to the given root and returns the new value.
static DtEnvValueSP addRealElement (DtEnvironmentSP env, DtEnvValueSP root, const DtString &name, double value)
 Adds a new real type to the given root and returns the new value.
static DtEnvValueSP addBooleanAttribute (DtEnvironmentSP env, DtEnvValueSP root, const DtString &name, bool value)
static DtEnvValueSP addStringElement (DtEnvironmentSP env, DtEnvValueSP root, const DtString &name, const DtString &value)
 Adds a new string type to the given root and returns the new value.
static DtEnvValueSP addStringAttribute (DtEnvironmentSP env, DtEnvValueSP root, const DtString &name, const DtString &value)
static void setObjectType (DtEnvironmentSP env, DtEnvValueSP root, const DtObjectType &t)
static void setMatchType (DtEnvironmentSP env, DtEnvValueSP root, const DtObjectType &t)
static void setPlatform (DtEnvironmentSP env, DtEnvValueSP root, const DtString &t)
static DtObjectType StringToObjectType (const std::string &str)
static DtObjectType getObjectTypeAttr (DtEnvironmentSP env, const DtString &attributeName, DtEnvValueSP root)
 Gets objecttype attribute from current Node.
static DtObjectType getObjectType (DtEnvironmentSP env, DtEnvValueSP root, bool fallbackOnMatchType=true)
static DtObjectType getMatchType (DtEnvironmentSP env, DtEnvValueSP root, bool fallbackOnObjectType=true)
static DtRangedObjectType getRangedObjectType (DtEnvironmentSP env, const DtString &attributeName, DtEnvValueSP root)
static double getDoubleAttribute (DtEnvironmentSP env, DtString attributeName, DtEnvValueSP root)
static int getIntegerFromHex (DtEnvironmentSP env, const DtString &attributeName, DtEnvValueSP root)
static int getInt (DtEnvironmentSP env, const DtString &attributeName, DtEnvValueSP root)
static bool ToBool (const DtString &str)
static bool getBoolAttribute (DtEnvironmentSP env, const DtString &attributeName, DtEnvValueSP root)
static void ExtractBindings (DtVariableBindingsList &list, const DtFilename &searchPath, DtEnvironmentSP env, DtEnvValueSP node)
 Get all direct child binding nodes.
static DtReaderWriterCreateRwObject (const DtString &rwType)
 Creates an RW object given the type.
static void getOrientation (DtEnvironmentSP env, const DtEnvValueSP parentNode, DtTaitBryan &orientation)
static void getXYZAttrs (DtEnvironmentSP env, const DtEnvValueSP root, double &x, double &y, double &z)
static void PopulateList (boost::function< void(DtReaderWriter *)> addFunction, DtEnvironmentSP env, DtEnvValueSP root, const DtFilename &searchPath, const DtVariableBindingsList &bindings, const vrfXml::TypeList &bindingTypes=vrfXml::theBindingTypes.types)
static void CreateVariableBinding (const DtString &bindingType, const DtFilename &searchPath, const DtVariableBindingsList &systemBindings, DtRwVariableBindings &newBindings, DtEnvironmentSP env, DtEnvValueSP binding)
 Creates a new variable binding using bindingType.
static void AddSystems (DtComponentSystemDescriptorList &list, const DtVariableBindingsList &variableBindings, DtEnvironmentSP env, DtEnvValueSP *root, const DtFilename &searchPath)
 Finds all system nodes, calls addSystem on each one.
static void AddSystem (DtComponentSystemDescriptorList &list, DtEnvironmentSP env, const DtVariableBindingsList &variableBindings, DtEnvValueSP root, const DtFilename &searchPath, DtEnvironmentSP parentEnt=DtEnvironmentSP(), DtString systemName="")
 Creates a new DtComponentSystemDescriptor from node.
static DtEnvironmentSP CreateVrfXmlEnvironment ()
static DtEnvironmentSP CreateVrfXmlEnvironment (const DtString &dataSourceFilename, bool showConsoleOutput=true)
 Creates a new DtEnvironment object using the data file name.
static DtEnvValueSP GetElementByType (DtEnvironmentSP env, const DtString &type, DtEnvValueSP root)
static DtEnvValueSPList GetElementsByType (DtEnvironmentSP env, const DtString &type, DtEnvValueSP root)
static DtString NLengthIntListToString (const DtNLengthIntegerVector &list)
static DtString NLengthStringListToString (const DtRwNLengthStringVector &list)
static void StringToNLengthIntList (const DtString &string, DtNLengthIntegerVector &list)
static void StringToNLengthStringList (const DtString &string, DtRwNLengthStringVector &list)
static DtEnvValueSP FindElementByParamName (DtEnvironmentSP env, const DtString &nodeType, const DtString &attributeValue, DtEnvValueSP envValue, bool traverseElements=true)
static DtEnvValueSP FindElementByAttrValue (DtEnvironmentSP env, const DtString &nodeType, const DtString &attributeName, const DtString &attributeValue, DtEnvValueSP envValue, bool traverseElements=true)
static DtReaderWriterRegistryDataDeepFindRw (const DtString &keyword, DtReaderWriterRegistry &registry, StringVector &path)
static bool IsGroupedElement (const DtString &rwName, const DtXmlUtils::GroupMappings &groupedElements, DtString &groupName)
static DtEnvValueSP FindGroupElement (DtEnvironmentSP env, DtEnvValueSP parentNode, const DtString &groupName, bool createIfMissing=true)
static void FindAndRemoveGroupElement (DtEnvironmentSP env, DtEnvValueSP parentNode, const DtString &groupName)
static void IterateOverChildren (DtReaderWriterRegistry &oldRegistry, DtReaderWriterRegistry &newRegistry, DtEnvironmentSP env, DtEnvValueSP root, const GroupMappings &groupedElements, StringVector &path)
static void ExtractVariableBindings (DtRwVariableBindings *variableBindings, DtEnvironmentSP env, DtEnvValueSP parentNode)
static void ExtractSystem (DtReaderWriter *systemObject, DtEnvironmentSP env, DtEnvValueSP simObjectNode)
static void ExtractSystems (DtReaderWriterRegistry &oldRegistry, DtEnvironmentSP env, DtEnvValueSP simObjectNode)
static void WriteXML (DtEnvironmentSP env, DtString filename)
static DtString removeQuotes (const DtString &str)
static void WriteVector (DtEnvironmentSP env, DtEnvValueSP root, const DtRwVector *vec, bool writeAsBodyPosition)
static bool WriteAsBodyPosition (const DtReaderWriter *rwObject)
static DtString IntToHexString (const int &number)
static DtString XmlBindingCharToMtl (const DtString &str)
 Can't use '$' for variables.
static DtString MtlBindingCharToXml (const DtString &str)
 Can't use '$' for variables.

Member Typedef Documentation

typedef std::list<DtEnvValueSP> DtXmlUtils::DtEnvValueSPList
typedef std::list<DtString> DtXmlUtils::StringVector
typedef std::list<DtString> DtXmlUtils::NameList

Member Function Documentation

static void DtXmlUtils::getObjectElements ( DtEnvironmentSP  env,
DtEnvValueSPList objectNodes 
)
static

XML Utility Functions.

Finds all of the vrfXml::SimObject nodes in the environment, starting from root.

static DtEnvValueSP DtXmlUtils::findObjectElementByMatchType ( DtEnvironmentSP  env,
const DtObjectType &  objType 
)
static

Finds an individual vrfXml::SimObject node by object type.

static DtEnvValueSP DtXmlUtils::findObjectElementByObjectType ( DtEnvironmentSP  env,
const DtObjectType &  objType 
)
static
static DtString DtXmlUtils::getAttribute ( DtEnvironmentSP  env,
const DtString name,
DtEnvValueSP  root 
)
static

Gets the named attribute from a DtEnvValueSP.

Returns "" if the attribute is not found. Note that some attribute names are reserved, and will not work, for example "name" and "type".

Referenced by DtXmlToRw::DtEnvValueToFormationTableEntry(), DtXmlToRw::DtEnvValueToRwBoundingVolume(), DtXmlToRw::DtEnvValueToRwLoadPoint(), DtXmlToRw::DtEnvValueToRwSoilFactors(), and DtXmlToRw::DtEnvValueToSlotExclusion().

static bool DtXmlUtils::hasAttribute ( DtEnvironmentSP  env,
const DtString name,
DtEnvValueSP  root 
)
static

Returns true if the attribute exists.

static bool DtXmlUtils::FindAndRemove ( DtEnvironmentSP  env,
const DtString nodeType,
const DtString paramName,
DtEnvValueSP  root 
)
static
static void DtXmlUtils::remove ( DtEnvironmentSP  ,
DtEnvValueSP   
)
static

Removes a value from the environment. Use this routine rather than the VR-Link remove routine.

static DtString DtXmlUtils::getPlatform ( DtEnvironmentSP  env,
DtEnvValueSP  root 
)
inlinestatic

Gets platform attribute from current Node.

References vrfXml::Platform.

static DtString DtXmlUtils::GetObjectValue ( DtEnvValueSP  root)
inlinestatic
static DtEnvValueSP DtXmlUtils::AddElement ( DtEnvironmentSP  env,
const DtString type,
DtEnvValueSP  root,
const DtString paramName = DtString::nullString() 
)
inlinestatic

References vrfXml::ParamName.

static DtEnvValueSP DtXmlUtils::addbooleanElement ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtString name,
bool  value 
)
inlinestatic

Adds a new boolean type to the given root and returns the new value.

References vrfXml::Bool.

static DtEnvValueSP DtXmlUtils::addRealElement ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtString name,
double  value 
)
inlinestatic

Adds a new real type to the given root and returns the new value.

References vrfXml::Real.

static DtEnvValueSP DtXmlUtils::addBooleanAttribute ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtString name,
bool  value 
)
inlinestatic
static DtEnvValueSP DtXmlUtils::addStringElement ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtString name,
const DtString value 
)
inlinestatic

Adds a new string type to the given root and returns the new value.

References vrfXml::String.

static DtEnvValueSP DtXmlUtils::addStringAttribute ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtString name,
const DtString value 
)
inlinestatic
static void DtXmlUtils::setObjectType ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtObjectType &  t 
)
inlinestatic

References vrfXml::ObjectType.

static void DtXmlUtils::setMatchType ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtObjectType &  t 
)
inlinestatic

References vrfXml::MatchType.

static void DtXmlUtils::setPlatform ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtString t 
)
inlinestatic

References vrfXml::Platform.

static DtObjectType DtXmlUtils::StringToObjectType ( const std::string &  str)
inlinestatic
static DtObjectType DtXmlUtils::getObjectTypeAttr ( DtEnvironmentSP  env,
const DtString attributeName,
DtEnvValueSP  root 
)
inlinestatic

Gets objecttype attribute from current Node.

static DtObjectType DtXmlUtils::getObjectType ( DtEnvironmentSP  env,
DtEnvValueSP  root,
bool  fallbackOnMatchType = true 
)
inlinestatic

References vrfXml::ObjectType.

static DtObjectType DtXmlUtils::getMatchType ( DtEnvironmentSP  env,
DtEnvValueSP  root,
bool  fallbackOnObjectType = true 
)
inlinestatic
static DtRangedObjectType DtXmlUtils::getRangedObjectType ( DtEnvironmentSP  env,
const DtString attributeName,
DtEnvValueSP  root 
)
static
static double DtXmlUtils::getDoubleAttribute ( DtEnvironmentSP  env,
DtString  attributeName,
DtEnvValueSP  root 
)
inlinestatic
static int DtXmlUtils::getIntegerFromHex ( DtEnvironmentSP  env,
const DtString attributeName,
DtEnvValueSP  root 
)
inlinestatic
static int DtXmlUtils::getInt ( DtEnvironmentSP  env,
const DtString attributeName,
DtEnvValueSP  root 
)
inlinestatic
static bool DtXmlUtils::ToBool ( const DtString str)
inlinestatic
static bool DtXmlUtils::getBoolAttribute ( DtEnvironmentSP  env,
const DtString attributeName,
DtEnvValueSP  root 
)
inlinestatic
static void DtXmlUtils::ExtractBindings ( DtVariableBindingsList list,
const DtFilename &  searchPath,
DtEnvironmentSP  env,
DtEnvValueSP  node 
)
static

Get all direct child binding nodes.

This is non-recursive - for example, if called on the root, it will not get bindings within system nodes.

static DtReaderWriter* DtXmlUtils::CreateRwObject ( const DtString rwType)
inlinestatic

Creates an RW object given the type.

References DtReaderWriterFactory::createItem(), and DtReaderWriter::factory().

static void DtXmlUtils::getOrientation ( DtEnvironmentSP  env,
const DtEnvValueSP  parentNode,
DtTaitBryan &  orientation 
)
inlinestatic
static void DtXmlUtils::getXYZAttrs ( DtEnvironmentSP  env,
const DtEnvValueSP  root,
double &  x,
double &  y,
double &  z 
)
inlinestatic
static void DtXmlUtils::PopulateList ( boost::function< void(DtReaderWriter *)>  addFunction,
DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtFilename &  searchPath,
const DtVariableBindingsList bindings,
const vrfXml::TypeList bindingTypes = vrfXml::theBindingTypes.types 
)
static
static void DtXmlUtils::CreateVariableBinding ( const DtString bindingType,
const DtFilename &  searchPath,
const DtVariableBindingsList systemBindings,
DtRwVariableBindings newBindings,
DtEnvironmentSP  env,
DtEnvValueSP  binding 
)
static

Creates a new variable binding using bindingType.

Uses the DtXmlRWFactory to assign value from DtEnvValueSP to the new DtReaderWriter object.

static void DtXmlUtils::AddSystems ( DtComponentSystemDescriptorList list,
const DtVariableBindingsList variableBindings,
DtEnvironmentSP  env,
DtEnvValueSP *  root,
const DtFilename &  searchPath 
)
static

Finds all system nodes, calls addSystem on each one.

static void DtXmlUtils::AddSystem ( DtComponentSystemDescriptorList list,
DtEnvironmentSP  env,
const DtVariableBindingsList variableBindings,
DtEnvValueSP  root,
const DtFilename &  searchPath,
DtEnvironmentSP  parentEnt = DtEnvironmentSP(),
DtString  systemName = "" 
)
static

Creates a new DtComponentSystemDescriptor from node.

static DtEnvironmentSP DtXmlUtils::CreateVrfXmlEnvironment ( )
static
static DtEnvironmentSP DtXmlUtils::CreateVrfXmlEnvironment ( const DtString dataSourceFilename,
bool  showConsoleOutput = true 
)
static

Creates a new DtEnvironment object using the data file name.

static DtEnvValueSP DtXmlUtils::GetElementByType ( DtEnvironmentSP  env,
const DtString type,
DtEnvValueSP  root 
)
static
static DtEnvValueSPList DtXmlUtils::GetElementsByType ( DtEnvironmentSP  env,
const DtString type,
DtEnvValueSP  root 
)
static
static DtString DtXmlUtils::XmlBindingCharToMtl ( const DtString str)
inlinestatic

Can't use '$' for variables.

so where we would use it, as in filenames with variables, it will be replaced with '@'.

References vrfXml::MtlVariableChar, and vrfXml::XmlVariableChar.

Referenced by DtXmlToRw::DtEnvValueToRwString().

static DtString DtXmlUtils::MtlBindingCharToXml ( const DtString str)
inlinestatic

Can't use '$' for variables.

so where we would use it, as in filenames with variables, it will be replaced with '@'.

References vrfXml::MtlVariableChar, and vrfXml::XmlVariableChar.

Referenced by DtRwToXml::DtFormationEntryToEnvValue().

static DtString DtXmlUtils::NLengthIntListToString ( const DtNLengthIntegerVector list)
static
static DtString DtXmlUtils::NLengthStringListToString ( const DtRwNLengthStringVector list)
static
static void DtXmlUtils::StringToNLengthIntList ( const DtString string,
DtNLengthIntegerVector list 
)
static
static void DtXmlUtils::StringToNLengthStringList ( const DtString string,
DtRwNLengthStringVector list 
)
static
static DtEnvValueSP DtXmlUtils::FindElementByParamName ( DtEnvironmentSP  env,
const DtString nodeType,
const DtString attributeValue,
DtEnvValueSP  envValue,
bool  traverseElements = true 
)
inlinestatic

References vrfXml::ParamName.

static DtEnvValueSP DtXmlUtils::FindElementByAttrValue ( DtEnvironmentSP  env,
const DtString nodeType,
const DtString attributeName,
const DtString attributeValue,
DtEnvValueSP  envValue,
bool  traverseElements = true 
)
static
static DtReaderWriterRegistryData* DtXmlUtils::DeepFindRw ( const DtString keyword,
DtReaderWriterRegistry registry,
StringVector path 
)
static
static bool DtXmlUtils::IsGroupedElement ( const DtString rwName,
const DtXmlUtils::GroupMappings groupedElements,
DtString groupName 
)
static
static DtEnvValueSP DtXmlUtils::FindGroupElement ( DtEnvironmentSP  env,
DtEnvValueSP  parentNode,
const DtString groupName,
bool  createIfMissing = true 
)
static
static void DtXmlUtils::FindAndRemoveGroupElement ( DtEnvironmentSP  env,
DtEnvValueSP  parentNode,
const DtString groupName 
)
static
static void DtXmlUtils::IterateOverChildren ( DtReaderWriterRegistry oldRegistry,
DtReaderWriterRegistry newRegistry,
DtEnvironmentSP  env,
DtEnvValueSP  root,
const GroupMappings groupedElements,
StringVector path 
)
static
static void DtXmlUtils::ExtractVariableBindings ( DtRwVariableBindings variableBindings,
DtEnvironmentSP  env,
DtEnvValueSP  parentNode 
)
static
static void DtXmlUtils::ExtractSystem ( DtReaderWriter systemObject,
DtEnvironmentSP  env,
DtEnvValueSP  simObjectNode 
)
static
static void DtXmlUtils::ExtractSystems ( DtReaderWriterRegistry oldRegistry,
DtEnvironmentSP  env,
DtEnvValueSP  simObjectNode 
)
static
static void DtXmlUtils::WriteXML ( DtEnvironmentSP  env,
DtString  filename 
)
inlinestatic

References vrfXml::SimObject.

static DtString DtXmlUtils::removeQuotes ( const DtString str)
inlinestatic
static void DtXmlUtils::WriteVector ( DtEnvironmentSP  env,
DtEnvValueSP  root,
const DtRwVector vec,
bool  writeAsBodyPosition 
)
inlinestatic
static bool DtXmlUtils::WriteAsBodyPosition ( const DtReaderWriter rwObject)
inlinestatic
static DtString DtXmlUtils::IntToHexString ( const int &  number)
inlinestatic

The documentation for this class was generated from the following file:

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)