Lodestone.Common
Loading...
Searching...
No Matches
StringSerializable.h
Go to the documentation of this file.
1//
2// Created by DexrnZacAttack on 10/15/25 using zPc-i2.
3//
4#ifndef LODESTONE_STRINGSERIALIZABLE_H
5#define LODESTONE_STRINGSERIALIZABLE_H
6
7// ReSharper disable once CppUnusedIncludeDirective
8#include <ostream>
9#include <string>
10
14 public:
15 constexpr StringSerializable() = default;
16
17 constexpr virtual ~StringSerializable() = default;
18
19 // virtual constexpr operator std::string() const { return toString(); }
20
21 virtual std::string toString() const = 0;
22
23 friend std::ostream &operator<<(std::ostream &os,
24 const StringSerializable &s) {
25 os << s.toString();
26 return os;
27 };
28 };
29} // namespace lodestone::common::string
30
31#endif // LODESTONE_STRINGSERIALIZABLE_H
friend std::ostream & operator<<(std::ostream &os, const StringSerializable &s)
Definition StringSerializable.h:23
virtual std::string toString() const =0
virtual constexpr ~StringSerializable()=default
Definition StringSerializable.h:11