Page 1 of 1

Write UserStrings to XML

Posted: Tue Aug 29, 2017 13:45
by FluXy
Hey Guys,

I recently managed to compile the latest CEED and noticed UserStrings are killed on Saving :cry:
Just implemented it but is there anything i could improve for a pull request?

I added the following to Window::writeXMLToStream() : after the line "writePropertiesXML(xml_stream);" :

Code: Select all

    // user strings
    const String UserStringXMLElementName( "UserString" );
    for( auto iter = d_userStrings.begin(); iter != d_userStrings.end(); ++iter )
    {
        const String& name = iter->first;
        // ignore auto props
        if( name.rfind( "_auto_prop__" ) != CEGUI::String::npos )
        {
            continue;
        }
        xml_stream.openTag(UserStringXMLElementName)
            .attribute(Property::NameXMLAttributeName, name);
        // Detect whether it is a long property or not
        const String& value = iter->second;
        if (value.find((String::value_type)'\n') != String::npos)
        {
            xml_stream.text(value);
        }
        else
        {
            xml_stream.attribute(Property::ValueXMLAttributeName, iter->second);
        }
        xml_stream.closeTag();
    }



Thankz!

Re: Write UserStrings to XML

Posted: Tue Aug 29, 2017 19:05
by Ident
What about deserialisation?

Re: Write UserStrings to XML

Posted: Wed Aug 30, 2017 21:39
by FluXy
Isn't that in GUILayout_xmlHandler::elementUserStringStart() ?!?

Re: Write UserStrings to XML

Posted: Sat Sep 02, 2017 22:20
by Ident
FluXy wrote:Isn't that in GUILayout_xmlHandler::elementUserStringStart() ?!?

In that case I have nothing to add and then it's a pretty clear bug :)

Re: Write UserStrings to XML

Posted: Thu Oct 05, 2017 10:25
by FluXy

Re: Write UserStrings to XML

Posted: Thu Oct 05, 2017 16:24
by Ident
FluXy wrote:Thanks! Request was created :)

https://bitbucket.org/cegui/cegui/pull- ... gs-to-xml/

I merged it. Looked alright. If you notice something wrong in the pulled change, then please make a new PR.

Other than that: thank you!