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

Method InitRegex

PathCopyCopy/src/PluginPipelineElements.cpp:255–274  ·  view source on GitHub ↗

Initializes the m_apRegex member using the other members. Call this method before needing to access the regex object. Note: m_apRegex will remain null if the regular expression is invalid.

Source from the content-addressed store, hash-verified

253 // Note: m_apRegex will remain null if the regular expression is invalid.
254 //
255 void RegexPipelineElement::InitRegex() const
256 {
257 // Only init once.
258 if (!m_RegexTested) {
259 // Try creating regex. Keep null if the regex is invalid.
260 try {
261 if (!m_Regex.empty()) {
262#pragma warning(suppress: 26812) // std::regex_constants::syntax_option_type could be enum class
263 std::regex_constants::syntax_option_type reOptions = std::regex_constants::ECMAScript;
264 if (m_IgnoreCase) {
265 reOptions |= std::regex_constants::icase;
266 }
267 m_upRegex = std::make_unique<std::wregex>(m_Regex, reOptions);
268 }
269 } catch (const std::regex_error&) {
270 assert(m_upRegex == nullptr);
271 }
272 m_RegexTested = true;
273 }
274 }
275
276 //
277 // Modifies the given path by replacing certain parts of the

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected