Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Showcase
  4. General Purpose Data Serializer
QtWS25 Last Chance

General Purpose Data Serializer

Scheduled Pinned Locked Moved Unsolved Showcase
serializationgpdsxml
7 Posts 4 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joel Bodenmann
    wrote on 11 May 2019, 14:12 last edited by
    #1

    Hi,

    Our company is developing several C++ / Qt applications that need to generate XML files that can be processed by other (3rd-party) XML processors/applications. Unfortunately, most existing serializers that produce XML output did not fit our requirements.
    I'm proud to present our solution: GPDS - A General Purpose Data Serializer.

    It's still in a very rough state but definitely usable. Everything can be found here: https://gpds.simulton.com

    The library comes with a *.pri file for easy integration into Qt projects. Furthermore, we'll add (de)serialization support for Qt types such as QString very soon.

    Any kind of feedback is welcomed.

    Industrial process automation software: https://simulton.com
    Embedded Graphics & GUI library: https://ugfx.io

    1 Reply Last reply
    6
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 12 May 2019, 07:06 last edited by
      #2

      Looks good! Any plans to support JSON output, too?

      (Z(:^

      1 Reply Last reply
      1
      • J Offline
        J Offline
        Joel Bodenmann
        wrote on 12 May 2019, 09:20 last edited by
        #3

        Yep, a JSON backend (within GPDS I call them "Archiver") is planned. However, adding support for Qt's standard types is higher up in the list of priorities right now. I assume JSON support will be there within a few days/weeks.

        After the JSON archiver there are plans to add support for binary formats such as BSON as well.

        Industrial process automation software: https://simulton.com
        Embedded Graphics & GUI library: https://ugfx.io

        1 Reply Last reply
        3
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 13 May 2019, 05:29 last edited by
          #4

          Nice, thanks :-)

          (Z(:^

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fcarney
            wrote on 13 May 2019, 14:35 last edited by
            #5

            Oh man, we have a serializer that produces <key> for every tag. I was wondering why on earth anyone would design a format that way. Now I understand why, it was produced by some kind of serializer. Thank you for providing some sanity to this mess we call xml. I like xml in concept, but some of the tools out there make me wonder about my sanity at times.

            C++ is a perfectly valid school of magic.

            1 Reply Last reply
            1
            • I Offline
              I Offline
              import
              Banned
              wrote on 18 May 2019, 11:42 last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • J Offline
                J Offline
                Joel Bodenmann
                wrote on 19 Jun 2019, 11:08 last edited by
                #7

                We've added support for the first Qt types: QString and qreal.
                You can now do this:

                class Color : public Gpds::Serialize
                {
                public:
                    QString name;
                    int red;
                    int green;
                    int blue;
                
                    virtual Gpds::Container toContainer() const override
                    {
                        Gpds::Container c;
                
                        c.setComment("a color object");
                        c.addAttribute("format", "rgb");
                        c.addAttribute("name", name);
                
                        c.addValue("red", red).addAttribute("depth", "32");
                        c.addValue("green", green).addAttribute("depth", "32");
                        c.addValue("blue", blue).addAttribute("depth", "32");
                
                        return c;
                    }
                
                    virtual void fromContainer(const Gpds::Container& c) override
                    {
                        // Retrieve format
                        const QString& formatString = c.getAttribute("format").value_or("n/a");
                        assert( formatString == "rgb" );
                
                        name = c.getAttribute("name").value_or("n/a");
                        red = c.getValue<int>("red");
                        green = c.getValue<int>("green");
                        blue = c.getValue<int>("blue");
                    }
                };
                

                Which will result in the following XML:

                <color format="rgb" name="Black">
                	<blue depth="32">0</blue>
                	<green depth="32">0</green>
                	<red depth="32">0</red>
                </color>
                

                There's also a Qt specific demo/example in the repo.

                Isn't the world wonderful?
                There's still a lot of stuff left to do tho.

                Industrial process automation software: https://simulton.com
                Embedded Graphics & GUI library: https://ugfx.io

                1 Reply Last reply
                2

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved