1.1-rc3
Public Types | Public Member Functions | Protected Attributes | List of all members
Serializer Class Referenceabstract

Abstract base serializer class. More...

Inheritance diagram for Serializer:
Inheritance graph
[legend]

Public Types

using Attributes = std::vector< std::pair< std::string, std::string > >
 Attributes array type. More...
 

Public Member Functions

 Serializer () noexcept=default
 
 Serializer (const Serializer &)=default
 
 Serializer (Serializer &&) noexcept=default
 
virtual ~Serializer () noexcept=default
 
virtual bool add (const Widget *widget, int level=0)=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...
 
void add_property (const std::string &name, const Pattern &value)
 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...
 
EGT_NODISCARD int level () const
 Get the current level. More...
 
Serializeroperator= (const Serializer &)=default
 
Serializeroperator= (Serializer &&) noexcept=default
 
virtual void write (std::ostream &out)=0
 Write to the specified ostream. More...
 

Protected Attributes

int m_level {0}
 Current serialize tree level. More...
 

Detailed Description

Abstract base serializer class.

Member Typedef Documentation

◆ Attributes

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

Attributes array type.

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,
int  level = 0 
)
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]

void add_property ( const std::string &  name,
const Pattern value 
)

Add a property.

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

◆ level()

EGT_NODISCARD int level ( ) const
inline

Get the current level.

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

Member Data Documentation

◆ m_level

int m_level {0}
protected

Current serialize tree level.