ECSTASY
All in the name
Loading...
Searching...
No Matches
ecstasy::serialization::ISerializer Class Referenceabstract

Interface for all serializer classes. More...

#include <ISerializer.hpp>

Inheritance diagram for ecstasy::serialization::ISerializer:

Public Member Functions

virtual ~ISerializer ()=default
 Destroy the ISerializer.
 
virtual void clear ()=0
 Clear the serializer content.
 
virtual size_t size () const =0
 Get the size of the serializer content (in bytes).
 
virtual void importFile (const std::filesystem::path &filename)=0
 Import data from a file into the serializer.
 
virtual void importBytes (const std::string &content)=0
 Import data from a string into the serializer.
 
virtual void importStream (std::istream &stream)=0
 Import data from a stream into the serializer.
 
virtual void exportFile (const std::filesystem::path &filename) const =0
 Export the serializer content to a file.
 
virtual std::string exportBytes () const =0
 Export the serializer content to a string.
 
virtual void exportStream (std::ostream &stream) const =0
 Export the serializer content to a stream.
 

Detailed Description

Interface for all serializer classes.

Note
As for many ecstasy classes, this class is empty and is used to group all serializer classes under the same type. This is required to store them in a container or to use them in a virtual function.
The serializer classes can be seen as a stream of bytes that can be read and written to.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-06-11)

Definition at line 31 of file ISerializer.hpp.

Constructor & Destructor Documentation

◆ ~ISerializer()

virtual ecstasy::serialization::ISerializer::~ISerializer ( )
virtualdefault

Destroy the ISerializer.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-06-11)

Member Function Documentation

◆ clear()

virtual void ecstasy::serialization::ISerializer::clear ( )
pure virtual

Clear the serializer content.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-09-12)

Implemented in ecstasy::serialization::JsonSerializer, and ecstasy::serialization::RawSerializer.

◆ exportBytes()

virtual std::string ecstasy::serialization::ISerializer::exportBytes ( ) const
pure virtual

Export the serializer content to a string.

Note
Calls the exportStream method with a stringstream.
Returns
std::string String representation of the serializer content.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-09-12)

Implemented in ecstasy::serialization::Serializer< S >, ecstasy::serialization::Serializer< JsonSerializer >, and ecstasy::serialization::Serializer< RawSerializer >.

◆ exportFile()

virtual void ecstasy::serialization::ISerializer::exportFile ( const std::filesystem::path filename) const
pure virtual

Export the serializer content to a file.

Note
Calls the exportStream method with a file stream.
Parameters
[in]filenamePath to the file to export the serializer content to.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-09-12)

Implemented in ecstasy::serialization::Serializer< S >, ecstasy::serialization::Serializer< JsonSerializer >, and ecstasy::serialization::Serializer< RawSerializer >.

◆ exportStream()

virtual void ecstasy::serialization::ISerializer::exportStream ( std::ostream stream) const
pure virtual

Export the serializer content to a stream.

Parameters
[in]streamStream to export the serializer content to.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-09-12)

Implemented in ecstasy::serialization::JsonSerializer, and ecstasy::serialization::RawSerializer.

◆ importBytes()

virtual void ecstasy::serialization::ISerializer::importBytes ( const std::string content)
pure virtual

Import data from a string into the serializer.

Note
Calls the importStream method with a stringstream.
Parameters
[in]contentString to import.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-09-12)

Implemented in ecstasy::serialization::Serializer< S >, ecstasy::serialization::Serializer< JsonSerializer >, and ecstasy::serialization::Serializer< RawSerializer >.

◆ importFile()

virtual void ecstasy::serialization::ISerializer::importFile ( const std::filesystem::path filename)
pure virtual

Import data from a file into the serializer.

Note
Calls the importStream method with a file stream.
Parameters
[in]filenamePath to the file to import.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-09-12)

Implemented in ecstasy::serialization::Serializer< S >, ecstasy::serialization::Serializer< JsonSerializer >, and ecstasy::serialization::Serializer< RawSerializer >.

◆ importStream()

virtual void ecstasy::serialization::ISerializer::importStream ( std::istream stream)
pure virtual

Import data from a stream into the serializer.

Parameters
[in]streamStream to import.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-09-12)

Implemented in ecstasy::serialization::JsonSerializer, and ecstasy::serialization::RawSerializer.

◆ size()

virtual size_t ecstasy::serialization::ISerializer::size ( ) const
pure virtual

Get the size of the serializer content (in bytes).

Returns
size_t Size of the serializer content in bytes.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-09-12)

Implemented in ecstasy::serialization::JsonSerializer, and ecstasy::serialization::RawSerializer.


The documentation for this class was generated from the following file: