KeyWorksRW / wxUiEditor

RAD tool used to create and maintain wxWidgets UI elements.
Apache License 2.0
61 stars 6 forks source link

Overhaul pugixml #1399

Closed Randalphwa closed 5 months ago

Randalphwa commented 5 months ago

This PR heavily refactors pugixml by removing large sections of code (compact, header-only, wide-character, non-standard template, etc.). That made it possible to use an anonymouse namespace without needing to outer namespaces to nest it in, switch to std:: functions instead of using macros to call those functions, etc.

A new load_file_string() function has been added to the xml_document class. This function is similar to load_file() but uses wxFile to load the file into a std::unique_ptr and processes it as a string. This also enables extended parsing error information.

xml_parse_result has been extended so that if load_string or load_file_string is called and a parsing error occurs, the line and column where the error occurred is set, and a detailed_msg is set.

While as_string() made it easier to update legacy pugixml projects, the name was misleading since it returned a view (non-zero terminated string). That's particularly true in the wxUiEditor code base where extensive use of node->as_string() is used and it returns const std::string&. To avoid the confusion, I changed the function names to as_view() and as_str() for returning std::string_view and std::string respectively.

Closes #1397