| 1 |
#pragma once |
| 2 |
|
| 3 |
#include <string> |
| 4 |
#include <memory> |
| 5 |
|
| 6 |
/** |
| 7 |
* \brief |
| 8 |
* Interface for an object which can serialise itself to/from a string. |
| 9 |
*/ |
| 10 |
class StringSerialisable |
| 11 |
{ |
| 12 |
public: |
| 13 |
/** |
| 14 |
* \brief |
| 15 |
* Destructor |
| 16 |
*/ |
| 17 |
virtual ~StringSerialisable() {} |
| 18 |
|
| 19 |
/** |
| 20 |
* \brief |
| 21 |
* Export this object's state to a string. |
| 22 |
*/ |
| 23 |
virtual std::string exportToString() const = 0; |
| 24 |
|
| 25 |
/** |
| 26 |
* \brief |
| 27 |
* Import this object's state from a given string. |
| 28 |
*/ |
| 29 |
virtual void importFromString(const std::string& str) = 0; |
| 30 |
}; |
| 31 |
|
| 32 |
typedef std::shared_ptr<StringSerialisable> StringSerialisablePtr; |
| 33 |
|