From a4de474a8c7639c62a51a18fc9b8a19c919cc50a Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 12 May 2015 19:09:34 +0200 Subject: [PATCH 01/10] Sequence: clean retrieveInfosFromPattern Less parameters: the function is not const because it updates the Sequence object. --- src/Sequence.cpp | 30 +++++++++++++----------------- src/Sequence.hpp | 2 +- src/filesystem.cpp | 3 +-- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/Sequence.cpp b/src/Sequence.cpp index 620818d..9f03c25 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -318,48 +318,44 @@ EPattern Sequence::checkPattern( const std::string& pattern, const EDetection de * and init internal values. * @param[in] pattern * @param[in] accept - * @param[out] prefix - * @param[out] suffix - * @param[out] padding - * @param[out] strictPadding */ -bool Sequence::retrieveInfosFromPattern( const std::string& filePattern, const EPattern& accept, std::string& prefix, std::string& suffix, std::size_t& padding, bool& strictPadding ) const +bool Sequence::retrieveInfosFromPattern( const std::string& filePattern, const EPattern& accept ) { boost::cmatch matches; - //std::cout << filePattern << " / " << prefix << " + " << padding << " + " << suffix << std::endl; + //std::cout << filePattern << " / " << _prefix << " + " << _padding << " + " << _suffix << std::endl; if( ( accept & ePatternStandard ) && regex_match( filePattern.c_str(), matches, regexPatternStandard ) ) { std::string paddingStr( matches[2].first, matches[2].second ); - padding = paddingStr.size(); - strictPadding = ( paddingStr[0] == '#' ); + _padding = paddingStr.size(); + _strictPadding = ( paddingStr[0] == '#' ); } else if( ( accept & ePatternCStyle ) && regex_match( filePattern.c_str(), matches, regexPatternCStyle ) ) { std::string paddingStr( matches[2].first, matches[2].second ); - padding = paddingStr.size() == 0 ? 0 : boost::lexical_cast ( paddingStr ); // if no padding value: %d -> padding = 0 - strictPadding = false; + _padding = paddingStr.size() == 0 ? 0 : boost::lexical_cast ( paddingStr ); // if no _padding value: %d -> _padding = 0 + _strictPadding = false; } else if( ( accept & ePatternFrame ) && regex_match( filePattern.c_str(), matches, regexPatternFrame ) ) { std::string frame( matches[2].first, matches[2].second ); // Time t = boost::lexical_cast