MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / DecodeRegexElement

Method DecodeRegexElement

PathCopyCopy/src/PluginPipelineDecoder.cpp:235–253  ·  view source on GitHub ↗

Decodes a RegexPipelineElement found in an encoded stream. @param p_rStream Stream containing encoded element. @return Newly-created element.

Source from the content-addressed store, hash-verified

233 // @return Newly-created element.
234 //
235 auto PipelineDecoder::DecodeRegexElement(PipelineDecoder::EncodedElementsStream& p_rStream) -> PipelineElementSP
236 {
237 // The data starts by a version number. This is used in case we need to add
238 // support for extra options in the future.
239 const auto version = p_rStream.ReadLong();
240
241 // Make sure it's a version we can support.
242 if (version > REGEX_ELEMENT_MAX_VERSION) {
243 throw InvalidPipelineException(ATL::CStringA(MAKEINTRESOURCEA(IDS_INVALIDPIPELINE_POSSIBLE_DOWNGRADE)));
244 }
245
246 // Initial version: regex, format string and whether we should ignore case.
247 const auto regex = p_rStream.ReadString();
248 const auto format = p_rStream.ReadString();
249 const auto ignoreCase = p_rStream.ReadBool();
250
251 // Create the element and return it.
252 return std::make_shared<RegexPipelineElement>(regex, format, ignoreCase);
253 }
254
255 //
256 // Decodes a CopyNPathPartsPipelineElement found in an encoded stream.

Callers

nothing calls this directly

Calls 4

ReadLongMethod · 0.80
ReadStringMethod · 0.80
ReadBoolMethod · 0.80

Tested by

no test coverage detected