Extends ParamNode:
- Each node can have multiple children with the same name
- Nodes are stored in the loading order
- ParamNode can be created from Javascript objects.
The intention is to be able to load GUI XML files into ParamNode, anticipating D3823.
While at it, this converts ParamNode's value to UTF8. XMB was switched to UTF8 in rP15309, and this considerable reduces the # of redundant conversions needed. This has side effects in a number of other files.
Other changes:
- To support the above, std::vector is used in place of std::map and the node name is moved to a member. This is likely to be equivalent or faster in random access efficiency, given that there are generally few children to a paramnode.
- Some implementation details are moved to a friend function to make incremental recompilation faster & hide them from the interface.
- There's some header cleanup.
- Some streamlining in ApplyLayer to make the control flow more obvious
- Split some functions
- Rename ToXML to ToXMLString since that's really what it was - this opens up the ability to generate an actual XML document, which might be good for validation (we current generate a string _then_ parse it to XML).
- Adapt everything to UTF8 - EscapeXmlString no longer replaces invalid codepoints because that was annoying to code & not extremely useful.
- Allow overwriting values when using `merge=""`.
I did some profiling, and overall I expect the slowdown (from having multiple same-name childs) to be irrelevant compared to the removed UTF8 conversions & the performance on the whole.
TODO:
- split off the CStrIntern changes
- There's some cleanup to do.
- The friend class should probably be a sub-class instead & its interface needs cleanup.
- Would be good to implement more stuff in JS.
- Would be good to allow loading XML without 'applying' it.