Write UserStrings to XML

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

User avatar
FluXy
Just popping in
Just popping in
Posts: 14
Joined: Mon Aug 22, 2005 03:34
Location: Germany
Contact:

Write UserStrings to XML

Postby FluXy » Tue Aug 29, 2017 13:45

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!

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Write UserStrings to XML

Postby Ident » Tue Aug 29, 2017 19:05

What about deserialisation?
CrazyEddie: "I don't like GUIs"

User avatar
FluXy
Just popping in
Just popping in
Posts: 14
Joined: Mon Aug 22, 2005 03:34
Location: Germany
Contact:

Re: Write UserStrings to XML

Postby FluXy » Wed Aug 30, 2017 21:39

Isn't that in GUILayout_xmlHandler::elementUserStringStart() ?!?

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Write UserStrings to XML

Postby Ident » Sat Sep 02, 2017 22:20

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 :)
CrazyEddie: "I don't like GUIs"

User avatar
FluXy
Just popping in
Just popping in
Posts: 14
Joined: Mon Aug 22, 2005 03:34
Location: Germany
Contact:

Re: Write UserStrings to XML

Postby FluXy » Thu Oct 05, 2017 10:25


User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Write UserStrings to XML

Postby Ident » Thu Oct 05, 2017 16:24

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!
CrazyEddie: "I don't like GUIs"


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests