hla: detect string and opaque data types.

This commit is contained in:
Mathias Froehlich 2011-10-04 19:48:34 +02:00
parent 7ffc84fb86
commit d951a55be0
3 changed files with 37 additions and 4 deletions

View File

@ -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 // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
@ -22,7 +22,9 @@
namespace simgear { namespace simgear {
HLAArrayDataType::HLAArrayDataType(const std::string& name) : 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; _elementDataType = elementDataType;
} }
void
HLAArrayDataType::setIsOpaque(bool isOpaque)
{
_isOpaque = isOpaque;
}
void
HLAArrayDataType::setIsString(bool isString)
{
_isString = isString;
}
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
HLAFixedArrayDataType::HLAFixedArrayDataType(const std::string& name) : HLAFixedArrayDataType::HLAFixedArrayDataType(const std::string& name) :

View File

@ -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 // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
@ -42,8 +42,18 @@ public:
const HLADataType* getElementDataType() const const HLADataType* getElementDataType() const
{ return _elementDataType.get(); } { return _elementDataType.get(); }
void setIsOpaque(bool isOpaque);
bool getIsOpaque() const
{ return _isOpaque; }
void setIsString(bool isString);
bool getIsString() const
{ return _isString; }
private: private:
SGSharedPtr<const HLADataType> _elementDataType; SGSharedPtr<const HLADataType> _elementDataType;
bool _isOpaque;
bool _isString;
}; };
class HLAFixedArrayDataType : public HLAArrayDataType { class HLAFixedArrayDataType : public HLAArrayDataType {

View File

@ -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 // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // 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()); 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; return arrayDataType;
} }