1.9
Public Member Functions | List of all members
OstreamWidgetSerializer Class Reference

Serialize a widget tree to an std::ostream. More...

Inheritance diagram for OstreamWidgetSerializer:
Inheritance graph
[legend]

Public Member Functions

 OstreamWidgetSerializer ()
 
 OstreamWidgetSerializer (const OstreamWidgetSerializer &)=delete
 
 OstreamWidgetSerializer (OstreamWidgetSerializer &&) noexcept=default
 
 ~OstreamWidgetSerializer () noexcept override
 
bool add (const Widget *widget) override
 Add a widget to the serializer. More...
 
void add_property (const std::string &name, bool value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, const AlignFlags &value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, const char *value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, const Pattern &value, const Attributes &attrs={}) override
 Add a property. More...
 
virtual void add_property (const std::string &name, const Pattern &value, const Attributes &attrs={})=0
 Add a property. More...
 
void add_property (const std::string &name, const std::string &value, const Attributes &attrs={}) override
 Add a property. More...
 
virtual void add_property (const std::string &name, const std::string &value, const Attributes &attrs={})=0
 Add a property. More...
 
void add_property (const std::string &name, double value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, float value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, int value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, unsigned int value, const Attributes &attrs={})
 Add a property. More...
 
Contextbegin_child (const std::string &nodename) override
 Create a new child. More...
 
void end_child (Context *context) override
 Complete a child. More...
 
OstreamWidgetSerializeroperator= (const OstreamWidgetSerializer &)=delete
 
OstreamWidgetSerializeroperator= (OstreamWidgetSerializer &&) noexcept=default
 
void reset ()
 Clear or reset, the serializer for re-use. More...
 
void write (std::ostream &out) override
 Write to the specified ostream. More...
 
- Public Member Functions inherited from Serializer
 Serializer () noexcept=default
 
 Serializer (const Serializer &)=default
 
 Serializer (Serializer &&) noexcept=default
 
virtual ~Serializer () noexcept=default
 
void add_property (const std::string &name, bool value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, const AlignFlags &value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, const char *value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, double value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, float value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, int value, const Attributes &attrs={})
 Add a property. More...
 
void add_property (const std::string &name, unsigned int value, const Attributes &attrs={})
 Add a property. More...
 
Serializeroperator= (const Serializer &)=default
 
Serializeroperator= (Serializer &&) noexcept=default
 

Additional Inherited Members

- Public Types inherited from Serializer
using Attributes = std::list< std::pair< std::string, std::string > >
 Attributes array type. More...
 
using Context = void
 
using Properties = std::list< std::tuple< std::string, std::string, Serializer::Attributes > >
 

Detailed Description

Serialize a widget tree to an std::ostream.

// already have a Window variable named win
OstreamWidgetSerializer out(std::cout);
out.add(&win);
See also
Widget::walk()

Constructor & Destructor Documentation

◆ OstreamWidgetSerializer() [1/3]

◆ OstreamWidgetSerializer() [2/3]

◆ OstreamWidgetSerializer() [3/3]

◆ ~OstreamWidgetSerializer()

~OstreamWidgetSerializer ( )
overridenoexcept

Member Function Documentation

◆ add()

bool add ( const Widget widget)
overridevirtual

Add a widget to the serializer.

Implements Serializer.

◆ add_property() [1/11]

void add_property

Add a property.

◆ add_property() [2/11]

void add_property

Add a property.

◆ add_property() [3/11]

void add_property
inline

Add a property.

◆ add_property() [4/11]

void add_property ( const std::string &  name,
const Pattern value,
const Attributes attrs = {} 
)
overridevirtual

Add a property.

Implements Serializer.

◆ add_property() [5/11]

virtual void add_property

Add a property.

◆ add_property() [6/11]

void add_property ( const std::string &  name,
const std::string &  value,
const Attributes attrs = {} 
)
overridevirtual

Add a property.

Implements Serializer.

◆ add_property() [7/11]

virtual void add_property

Add a property.

◆ add_property() [8/11]

void add_property

Add a property.

◆ add_property() [9/11]

void add_property

Add a property.

◆ add_property() [10/11]

void add_property

Add a property.

◆ add_property() [11/11]

void add_property

Add a property.

◆ begin_child()

Context* begin_child ( const std::string &  nodename)
overridevirtual

Create a new child.

Implements Serializer.

◆ end_child()

void end_child ( Context context)
overridevirtual

Complete a child.

Implements Serializer.

◆ operator=() [1/2]

OstreamWidgetSerializer& operator= ( const OstreamWidgetSerializer )
delete

◆ operator=() [2/2]

OstreamWidgetSerializer& operator= ( OstreamWidgetSerializer &&  )
defaultnoexcept

◆ reset()

void reset ( )

Clear or reset, the serializer for re-use.

◆ write()

void write ( std::ostream &  out)
overridevirtual

Write to the specified ostream.

Implements Serializer.