aboutsummaryrefslogtreecommitdiff
path: root/include/dchat/OutgoingMessage.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-01-27 02:09:50 +0100
committerdec05eba <dec05eba@protonmail.com>2020-08-18 23:38:23 +0200
commit6778e3b87cc9a6f5d195a2c80e5b499e3d94558b (patch)
treed37e25d48168465bdf0fb29559fe6e186a15e1d7 /include/dchat/OutgoingMessage.hpp
parent2446736bc775b22cf5aaae88c2c69c9504e5eb17 (diff)
Add binds to emoji parsing, refactor
Diffstat (limited to 'include/dchat/OutgoingMessage.hpp')
-rw-r--r--include/dchat/OutgoingMessage.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/dchat/OutgoingMessage.hpp b/include/dchat/OutgoingMessage.hpp
new file mode 100644
index 0000000..c3e8e84
--- /dev/null
+++ b/include/dchat/OutgoingMessage.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "types.hpp"
+#include "Range.hpp"
+#include <functional>
+#include <unordered_map>
+#include <string>
+
+namespace dchat
+{
+ struct OutgoingMessagePart
+ {
+ enum class Type
+ {
+ TEXT,
+ EMOJI
+ };
+
+ Type type;
+ union
+ {
+ Range textRange;
+ const std::string *emoji;
+ };
+
+ OutgoingMessagePart(Type _type, Range _textRange) : type(_type), textRange(_textRange) {}
+ OutgoingMessagePart(Type _type, const std::string *_emoji) : type(_type), emoji(_emoji) {}
+ };
+
+ using EmojiBindMap = std::unordered_map<std::string, std::string>;
+
+ void parseOutgoingMessage(const char *text, usize size, const EmojiBindMap &emojiBindMap, std::function<void(OutgoingMessagePart)> callbackFunc);
+} \ No newline at end of file