14#include <egt/detail/meta.h>
15#include <egt/widgetflags.h>
45 using
Attributes = std::list<std::pair<std::
string, std::
string>>;
50 virtual
bool add(const
Widget* widget) = 0;
53 virtual
Context* begin_child(const std::
string& nodename) = 0;
56 virtual
void end_child(
Context* context) = 0;
59 virtual
void add_property(const std::
string& name, const std::
string& value,
65 add_property(name, std::string(value), attrs);
92 virtual void write(std::ostream& out) = 0;
122 Context* begin_child(const std::
string& nodename) override;
128 void add_property(const std::
string& name, const std::
string& value,
134 void write(std::ostream& out)
override;
140 struct OstreamSerializerImpl;
141 std::unique_ptr<OstreamSerializerImpl> m_impl;
173 Context* begin_child(const std::
string& nodename) override;
179 void add_property(const std::
string& name, const std::
string& value,
186 void write(
const std::string& filename);
189 void write(std::ostream& out)
override;
195 struct XmlSerializerImpl;
196 std::unique_ptr<XmlSerializerImpl> m_impl;
204 virtual std::unique_ptr<Deserializer>
first_child(
const std::string& name =
"")
const = 0;
205 virtual std::unique_ptr<Deserializer>
next_sibling(
const std::string& name =
"")
const = 0;
Alignment flags.
Definition widgetflags.h:379
Definition serialize.h:200
virtual std::unique_ptr< Deserializer > next_sibling(const std::string &name="") const =0
virtual std::unique_ptr< Deserializer > first_child(const std::string &name="") const =0
virtual bool is_valid() const =0
virtual std::shared_ptr< Widget > parse_widget() const =0
virtual bool get_property(const std::string &name, std::string *value, Serializer::Attributes *attrs=nullptr) const =0
virtual ~Deserializer()
Definition serialize.h:202
A Pattern which can store one or more colors at different offsets (steps) which can be used to create...
Definition pattern.h:55
Abstract base serializer class.
Definition serialize.h:34
virtual void add_property(const std::string &name, const Pattern &value, const Attributes &attrs={})=0
Add a property.
void add_property(const std::string &name, const AlignFlags &value, const Attributes &attrs={})
Add a property.
Serializer() noexcept=default
void add_property(const std::string &name, double value, const Attributes &attrs={})
Add a property.
virtual void write(std::ostream &out)=0
Write to the specified ostream.
void add_property(const std::string &name, float value, const Attributes &attrs={})
Add a property.
std::list< std::pair< std::string, std::string > > Attributes
Attributes array type.
Definition serialize.h:45
void add_property(const std::string &name, bool value, const Attributes &attrs={})
Add a property.
void add_property(const std::string &name, const char *value, const Attributes &attrs={})
Add a property.
Definition serialize.h:62
void add_property(const std::string &name, int value, const Attributes &attrs={})
Add a property.
void Context
Definition serialize.h:36
std::list< std::tuple< std::string, std::string, Serializer::Attributes > > Properties
Definition serialize.h:47
virtual ~Serializer() noexcept=default
void add_property(const std::string &name, unsigned int value, const Attributes &attrs={})
Add a property.
EGT framework namespace.
Definition animation.h:24