From 40718158aec71537bdc06d0d4fcab249f43edb3a Mon Sep 17 00:00:00 2001 From: HiepLM Date: Sun, 22 Mar 2026 17:18:19 +0700 Subject: [PATCH] fixbug --- include/robot_xmlrpcpp/XmlRpcValue.h | 3 +++ src/XmlRpcValue.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/include/robot_xmlrpcpp/XmlRpcValue.h b/include/robot_xmlrpcpp/XmlRpcValue.h index 16f96d2..0e5027b 100644 --- a/include/robot_xmlrpcpp/XmlRpcValue.h +++ b/include/robot_xmlrpcpp/XmlRpcValue.h @@ -112,6 +112,9 @@ namespace robot_xmlrpcpp { //! Check for the existence of a struct member by name. bool hasMember(const std::string& name) const; + //! If this value is a struct, returns pointer to its members; otherwise nullptr. + const ValueStruct *getStructMembers() const; + //! Decode xml. Destroys any existing value. bool fromXml(std::string const& valueXml, int* offset); diff --git a/src/XmlRpcValue.cpp b/src/XmlRpcValue.cpp index ca92a6d..883fb9b 100644 --- a/src/XmlRpcValue.cpp +++ b/src/XmlRpcValue.cpp @@ -209,6 +209,13 @@ namespace robot_xmlrpcpp { return _type == TypeStruct && _value.asStruct->find(name) != _value.asStruct->end(); } + const XmlRpcValue::ValueStruct *XmlRpcValue::getStructMembers() const + { + if (_type != TypeStruct) + return nullptr; + return _value.asStruct; + } + // Set the value from xml. The chars at *offset into valueXml // should be the start of a tag. Destroys any existing value. bool XmlRpcValue::fromXml(std::string const& valueXml, int* offset)