X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fhla%2FHLADataElement.cxx;h=b7da888412e647aaca5eb0d0e5a1051ebd8a3d34;hb=c39926dd721e5dee2c086bcabfdf561b12475eff;hp=ae981128543722ed91837ab955ef1ae2021750a4;hpb=ce71b8c1cf761742ab88975442f4037b5e460114;p=simgear.git diff --git a/simgear/hla/HLADataElement.cxx b/simgear/hla/HLADataElement.cxx index ae981128..b7da8884 100644 --- a/simgear/hla/HLADataElement.cxx +++ b/simgear/hla/HLADataElement.cxx @@ -19,6 +19,8 @@ #include +#include "HLADataElementVisitor.hxx" + namespace simgear { HLADataElement::PathElement::Data::~Data() @@ -129,6 +131,18 @@ HLADataElement::~HLADataElement() { } +void +HLADataElement::accept(HLADataElementVisitor& visitor) +{ + visitor.apply(*this); +} + +void +HLADataElement::accept(HLAConstDataElementVisitor& visitor) const +{ + visitor.apply(*this); +} + std::string HLADataElement::toString(const Path& path) { @@ -138,11 +152,11 @@ HLADataElement::toString(const Path& path) return s; } -HLADataElement::AttributePathPair -HLADataElement::toAttributePathPair(const std::string& s) +HLADataElement::StringPathPair +HLADataElement::toStringPathPair(const std::string& s) { Path path; - // Skip the initial attribute name if given + // Skip the initial attribute/parameter name if given std::string::size_type i = s.find_first_of("[."); std::string attribute = s.substr(0, i); while (i < s.size()) { @@ -157,7 +171,7 @@ HLADataElement::toAttributePathPair(const std::string& s) if (10 <= v) { SG_LOG(SG_NETWORK, SG_WARN, "HLADataElement: invalid character in array subscript for \"" << s << "\" at \"" << attribute << toString(path) << "\"!"); - return AttributePathPair(); + return StringPathPair(); } index *= 10; index += v; @@ -172,7 +186,7 @@ HLADataElement::toAttributePathPair(const std::string& s) if (s.size() <= ++i) { SG_LOG(SG_NETWORK, SG_WARN, "HLADataElement: invalid terminating '.' for \"" << s << "\"!"); - return AttributePathPair(); + return StringPathPair(); } std::string::size_type e = s.find_first_of("[.", i); path.push_back(s.substr(i, e - i)); @@ -181,7 +195,7 @@ HLADataElement::toAttributePathPair(const std::string& s) } } - return AttributePathPair(attribute, path); + return StringPathPair(attribute, path); } }