1.8
Public Types | Public Member Functions | List of all members
Serializer Class Referenceabstract

Abstract base serializer class. More...

Inheritance diagram for Serializer:
Inheritance graph
[legend]

Public Types

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 > >
 

Public Member Functions

 Serializer () noexcept=default
 
 Serializer (const Serializer &)=default
 
 Serializer (Serializer &&) noexcept=default
 
virtual ~Serializer () noexcept=default
 
virtual bool add (const Widget *widget)=0
 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...
 
virtual void add_property (const std::string &name, const Pattern &value, const Attributes &attrs={})=0
 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...
 
virtual Contextbegin_child (const std::string &nodename)=0
 Create a new child. More...
 
virtual void end_child (Context *context)=0
 Complete a child. More...
 
Serializeroperator= (const Serializer &)=default
 
Serializeroperator= (Serializer &&) noexcept=default
 
virtual void write (std::ostream &out)=0
 Write to the specified ostream. More...
 

Detailed Description

Abstract base serializer class.

Member Typedef Documentation

◆ Attributes

using Attributes = std::list<std::pair<std::string, std::string> >

Attributes array type.

◆ Context

using Context = void

◆ Properties

using Properties = std::list<std::tuple<std::string, std::string, Serializer::Attributes> >

Constructor & Destructor Documentation

◆ Serializer() [1/3]

Serializer ( )
defaultnoexcept

◆ Serializer() [2/3]

Serializer ( const Serializer )
default

◆ Serializer() [3/3]

Serializer ( Serializer &&  )
defaultnoexcept

◆ ~Serializer()

virtual ~Serializer ( )
virtualdefaultnoexcept

Member Function Documentation

◆ add()

virtual bool add ( const Widget widget)
pure virtual

Add a widget to the serializer.

Implemented in XmlWidgetSerializer, and OstreamWidgetSerializer.

◆ add_property() [1/9]

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

Add a property.

◆ add_property() [2/9]

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

Add a property.

◆ add_property() [3/9]

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

Add a property.

◆ add_property() [4/9]

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

Add a property.

Implemented in XmlWidgetSerializer, and OstreamWidgetSerializer.

◆ add_property() [5/9]

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

Add a property.

Implemented in XmlWidgetSerializer, and OstreamWidgetSerializer.

◆ add_property() [6/9]

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

Add a property.

◆ add_property() [7/9]

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

Add a property.

◆ add_property() [8/9]

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

Add a property.

◆ add_property() [9/9]

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

Add a property.

◆ begin_child()

virtual Context* begin_child ( const std::string &  nodename)
pure virtual

Create a new child.

Implemented in XmlWidgetSerializer, and OstreamWidgetSerializer.

◆ end_child()

virtual void end_child ( Context context)
pure virtual

Complete a child.

Implemented in XmlWidgetSerializer, and OstreamWidgetSerializer.

◆ operator=() [1/2]

Serializer& operator= ( const Serializer )
default

◆ operator=() [2/2]

Serializer& operator= ( Serializer &&  )
defaultnoexcept

◆ write()

virtual void write ( std::ostream &  out)
pure virtual

Write to the specified ostream.

Implemented in XmlWidgetSerializer, and OstreamWidgetSerializer.