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.