MCPcopy Create free account
hub / github.com/Tom94/tev / interpretAsOpenImage

Method interpretAsOpenImage

src/Ipc.cpp:176–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176IpcPacketOpenImage IpcPacket::interpretAsOpenImage() const {
177 IpcPacketOpenImage result;
178 IStream payload{mPayload};
179
180 EType type;
181 payload >> type;
182 if (type != EType::OpenImage && type != EType::OpenImageV2) {
183 throw runtime_error{"Cannot interpret IPC packet as OpenImage."};
184 }
185
186 payload >> result.grabFocus;
187
188 string imageString;
189 payload >> imageString;
190
191 if (type >= EType::OpenImageV2) {
192 result.imagePath = imageString;
193 payload >> result.channelSelector;
194 return result;
195 }
196
197 const size_t colonPos = imageString.find_last_of(":");
198 if (colonPos == string::npos ||
199 // windows path of the form X:/* or X:\*
200 (colonPos == 1 && imageString.length() >= 3 && (imageString[2] == '\\' || imageString[2] == '/'))) {
201 result.imagePath = imageString;
202 result.channelSelector = "";
203 } else {
204 result.imagePath = imageString.substr(0, colonPos);
205 result.channelSelector = imageString.substr(colonPos + 1);
206 }
207
208 return result;
209}
210
211IpcPacketReloadImage IpcPacket::interpretAsReloadImage() const {
212 IpcPacketReloadImage result;

Callers 1

handleIpcPacketFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected