From d951a55be0b032350e04d68d561bb21dfa69ec87 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Tue, 4 Oct 2011 19:48:34 +0200 Subject: [PATCH] hla: detect string and opaque data types. --- simgear/hla/HLAArrayDataType.cxx | 18 ++++++++++++++++-- simgear/hla/HLAArrayDataType.hxx | 12 +++++++++++- simgear/hla/HLAOMTXmlVisitor.cxx | 11 ++++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/simgear/hla/HLAArrayDataType.cxx b/simgear/hla/HLAArrayDataType.cxx index 0eac2364..f52da283 100644 --- a/simgear/hla/HLAArrayDataType.cxx +++ b/simgear/hla/HLAArrayDataType.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de +// Copyright (C) 2009 - 2011 Mathias Froehlich - Mathias.Froehlich@web.de // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -22,7 +22,9 @@ namespace simgear { HLAArrayDataType::HLAArrayDataType(const std::string& name) : - HLADataType(name) + HLADataType(name), + _isOpaque(false), + _isString(false) { } @@ -51,6 +53,18 @@ HLAArrayDataType::setElementDataType(const HLADataType* elementDataType) _elementDataType = elementDataType; } +void +HLAArrayDataType::setIsOpaque(bool isOpaque) +{ + _isOpaque = isOpaque; +} + +void +HLAArrayDataType::setIsString(bool isString) +{ + _isString = isString; +} + /////////////////////////////////////////////////////////////////////////////////// HLAFixedArrayDataType::HLAFixedArrayDataType(const std::string& name) : diff --git a/simgear/hla/HLAArrayDataType.hxx b/simgear/hla/HLAArrayDataType.hxx index eac645b4..a38f05bc 100644 --- a/simgear/hla/HLAArrayDataType.hxx +++ b/simgear/hla/HLAArrayDataType.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de +// Copyright (C) 2009 - 2011 Mathias Froehlich - Mathias.Froehlich@web.de // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -42,8 +42,18 @@ public: const HLADataType* getElementDataType() const { return _elementDataType.get(); } + void setIsOpaque(bool isOpaque); + bool getIsOpaque() const + { return _isOpaque; } + + void setIsString(bool isString); + bool getIsString() const + { return _isString; } + private: SGSharedPtr _elementDataType; + bool _isOpaque; + bool _isString; }; class HLAFixedArrayDataType : public HLAArrayDataType { diff --git a/simgear/hla/HLAOMTXmlVisitor.cxx b/simgear/hla/HLAOMTXmlVisitor.cxx index 06351d6a..fa731eb3 100644 --- a/simgear/hla/HLAOMTXmlVisitor.cxx +++ b/simgear/hla/HLAOMTXmlVisitor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de +// Copyright (C) 2009 - 2011 Mathias Froehlich - Mathias.Froehlich@web.de // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -439,6 +439,15 @@ HLAOMTXmlVisitor::getArrayDataType(const std::string& dataTypeName, HLAOMTXmlVis } arrayDataType->setElementDataType(elementDataType.get()); + // Check if this should be a string data type + if (elementDataType->toBasicDataType()) { + if (dataTypeName == "HLAopaqueData") { + arrayDataType->setIsOpaque(true); + } else if (dataTypeName.find("String") != std::string::npos || dataTypeName.find("string") != std::string::npos) { + arrayDataType->setIsString(true); + } + } + return arrayDataType; } -- 2.39.5