]> git.mxchange.org Git - simgear.git/blobdiff - simgear/hla/HLAObjectClass.cxx
Windows versionhelpers.h support.
[simgear.git] / simgear / hla / HLAObjectClass.cxx
index 06287c38a28e3cf5b622eb96616e4f865d20e162..2740eb029d461ad6e573cf90331d9d3dbcb0e8a8 100644 (file)
@@ -191,33 +191,14 @@ HLAObjectClass::setAttributePublicationType(unsigned index, HLAPublicationType p
     _attributeVector[index]._publicationType = publicationType;
 }
 
-HLADataElement::IndexPathPair
-HLAObjectClass::getIndexPathPair(const HLADataElement::StringPathPair& stringPathPair) const
-{
-    unsigned index = getAttributeIndex(stringPathPair.first);
-    if (getNumAttributes() <= index) {
-        SG_LOG(SG_NETWORK, SG_ALERT, "HLAObjectClass::getIndexPathPair(\""
-               << HLADataElement::toString(stringPathPair)
-               << "\"): Could not resolve attribute \"" << stringPathPair.first
-               << "\" for object class \"" << getName() << "\"!");
-    }
-    return HLADataElement::IndexPathPair(index, stringPathPair.second);
-}
-
-HLADataElement::IndexPathPair
-HLAObjectClass::getIndexPathPair(const std::string& path) const
-{
-    return getIndexPathPair(HLADataElement::toStringPathPair(path));
-}
-
 bool
-HLAObjectClass::getAttributeIndex(HLADataElementIndex& dataElementIndex, const std::string& path) const
+HLAObjectClass::getDataElementIndex(HLADataElementIndex& dataElementIndex, const std::string& path) const
 {
     if (path.empty()) {
         SG_LOG(SG_NETWORK, SG_ALERT, "HLAObjectClass: failed to parse empty element path!");
         return false;
     }
-    size_t len = path.find_first_of("[.");
+    std::string::size_type len = std::min(path.find_first_of("[."), path.size());
     unsigned index = 0;
     while (index < getNumAttributes()) {
         if (path.compare(0, len, getAttributeName(index)) == 0)
@@ -240,6 +221,14 @@ HLAObjectClass::getAttributeIndex(HLADataElementIndex& dataElementIndex, const s
     return getAttributeDataType(index)->getDataElementIndex(dataElementIndex, path, len);
 }
 
+HLADataElementIndex
+HLAObjectClass::getDataElementIndex(const std::string& path) const
+{
+    HLADataElementIndex dataElementIndex;
+    getDataElementIndex(dataElementIndex, path);
+    return dataElementIndex;
+}
+
 bool
 HLAObjectClass::subscribe()
 {