Add mj_parseXML and mj_saveXML to xml_api.

PiperOrigin-RevId: 640099466
Change-Id: I75f763523c5bc8f6f7c2f2de6806d82ba37ebd4e
This commit is contained in:
Alessio Quaglino
2024-06-04 11:59:32 +01:00
committed by Saran Tunyasuvunakool
parent 1bf90af0e0
commit b35ae973e1
11 changed files with 143 additions and 37 deletions
+3 -4
View File
@@ -24,15 +24,14 @@
// Top level API
// Main writer function
std::string mjWriteXML(mjSpec* spec, char* error, int error_sz);
std::string mjWriteXML(const mjSpec* spec, char* error, int error_sz);
// Main parser function
MJAPI mjSpec* mjParseXML(const char* filename, const mjVFS* vfs, char* error, int error_sz);
mjSpec* mjParseXML(const char* filename, const mjVFS* vfs, char* error, int error_sz);
// Returns a newly-allocated mjSpec, loaded from the contents of xml.
// On failure returns nullptr and populates the error array if present.
MJAPI mjSpec* ParseSpecFromString(std::string_view xml, char* error = nullptr,
int error_size = 0, mjVFS* vfs = nullptr);
mjSpec* ParseSpecFromString(std::string_view xml, char* error = nullptr, int error_size = 0);
#endif // MUJOCO_SRC_XML_XML_H_