case message WrapperObject kClipboardobj auto pObject std make_unique

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
case message::WrapperObject::kClipboardobj: {
auto pObject = std::make_unique<Model::Message>(Contract::MessageType::Keyboard, Contract::MessageCategory::Object); // FIXME: ???!!!
auto &ref = obj.clipboardobj();
pObject->AddProperty(Contract::PropertyType::Account, ref.account());
pObject->AddProperty(Contract::PropertyType::WindowName, ref.windowname());
pObject->AddProperty(Contract::PropertyType::ProcessName, ref.processname());
if (ref.action() == message::ClipboardObject_ActionEnum::ClipboardObject_ActionEnum_Copy) {
std::string res = "[CTRL+C]";
res += ref.content() + "[CTRL+C]";
pObject->AddProperty(Contract::PropertyType::Text, convertToChunk(ref.content()));
pObject->AddProperty(Contract::PropertyType::Content, convertToChunk(res));
} else {
if (ref.action() == message::ClipboardObject_ActionEnum::ClipboardObject_ActionEnum_Paste) {
std::string res = "[CTRL+V]";
res += ref.content() + "[CTRL+V]";
pObject->AddProperty(Contract::PropertyType::Text, convertToChunk(ref.content()));
pObject->AddProperty(Contract::PropertyType::Content, convertToChunk(res));
} else {
throw std::logic_error("message::ClipboardObject_ActionEnum unsupported val");
}
}
return pObject;
}