add serializer (setup) for the basic message components
This commit is contained in:
parent
4039239c16
commit
5b9909a989
@ -5,6 +5,11 @@ project(solanaceae)
|
|||||||
add_library(solanaceae_message_serializer
|
add_library(solanaceae_message_serializer
|
||||||
./solanaceae/message3/message_serializer.hpp
|
./solanaceae/message3/message_serializer.hpp
|
||||||
./solanaceae/message3/message_serializer.cpp
|
./solanaceae/message3/message_serializer.cpp
|
||||||
|
|
||||||
|
# TODO: extract?
|
||||||
|
./solanaceae/message3/nj/message_components.hpp
|
||||||
|
./solanaceae/message3/nj/message_components_serializer.hpp
|
||||||
|
./solanaceae/message3/nj/message_components_serializer.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(solanaceae_message_serializer PUBLIC .)
|
target_include_directories(solanaceae_message_serializer PUBLIC .)
|
||||||
|
29
src/solanaceae/message3/nj/message_components.hpp
Normal file
29
src/solanaceae/message3/nj/message_components.hpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <solanaceae/util/utils.hpp>
|
||||||
|
|
||||||
|
#include <solanaceae/message3/components.hpp>
|
||||||
|
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
namespace Message::Components {
|
||||||
|
|
||||||
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Timestamp, ts)
|
||||||
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampProcessed, ts)
|
||||||
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampWritten, ts)
|
||||||
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactFrom, c)
|
||||||
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactTo, c)
|
||||||
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Read, ts)
|
||||||
|
// TODO: SyncedBy
|
||||||
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MessageText, text)
|
||||||
|
|
||||||
|
// TODO: remove
|
||||||
|
//namespace Transfer {
|
||||||
|
//NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo::FileDirEntry, file_name, file_size)
|
||||||
|
//NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo, file_list, total_size)
|
||||||
|
//NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfoLocal, file_list)
|
||||||
|
//} // Transfer
|
||||||
|
|
||||||
|
} // Message::Components
|
||||||
|
|
||||||
|
|
34
src/solanaceae/message3/nj/message_components_serializer.cpp
Normal file
34
src/solanaceae/message3/nj/message_components_serializer.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "./message_components_serializer.hpp"
|
||||||
|
|
||||||
|
#include "./message_components.hpp"
|
||||||
|
|
||||||
|
void registerMessageComponents(MessageSerializerNJ& msnj) {
|
||||||
|
msnj.registerSerializer<Message::Components::Timestamp>();
|
||||||
|
msnj.registerDeserializer<Message::Components::Timestamp>();
|
||||||
|
msnj.registerSerializer<Message::Components::TimestampProcessed>();
|
||||||
|
msnj.registerDeserializer<Message::Components::TimestampProcessed>();
|
||||||
|
msnj.registerSerializer<Message::Components::TimestampWritten>();
|
||||||
|
msnj.registerDeserializer<Message::Components::TimestampWritten>();
|
||||||
|
msnj.registerSerializer<Message::Components::ContactFrom>();
|
||||||
|
msnj.registerDeserializer<Message::Components::ContactFrom>();
|
||||||
|
msnj.registerSerializer<Message::Components::ContactTo>();
|
||||||
|
msnj.registerDeserializer<Message::Components::ContactTo>();
|
||||||
|
msnj.registerSerializer<Message::Components::TagUnread>();
|
||||||
|
msnj.registerDeserializer<Message::Components::TagUnread>();
|
||||||
|
msnj.registerSerializer<Message::Components::Read>();
|
||||||
|
msnj.registerDeserializer<Message::Components::Read>();
|
||||||
|
msnj.registerSerializer<Message::Components::MessageText>();
|
||||||
|
msnj.registerDeserializer<Message::Components::MessageText>();
|
||||||
|
msnj.registerSerializer<Message::Components::TagMessageIsAction>();
|
||||||
|
msnj.registerDeserializer<Message::Components::TagMessageIsAction>();
|
||||||
|
|
||||||
|
// files
|
||||||
|
//_sc.registerSerializerJson<Message::Components::Transfer::FileID>()
|
||||||
|
//_sc.registerSerializerJson<Message::Components::Transfer::FileInfo>();
|
||||||
|
//_sc.registerDeSerializerJson<Message::Components::Transfer::FileInfo>();
|
||||||
|
//_sc.registerSerializerJson<Message::Components::Transfer::FileInfoLocal>();
|
||||||
|
//_sc.registerDeSerializerJson<Message::Components::Transfer::FileInfoLocal>();
|
||||||
|
//_sc.registerSerializerJson<Message::Components::Transfer::TagHaveAll>();
|
||||||
|
//_sc.registerDeSerializerJson<Message::Components::Transfer::TagHaveAll>();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <solanaceae/message3/message_serializer.hpp>
|
||||||
|
|
||||||
|
void registerMessageComponents(MessageSerializerNJ& msnj);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user