TuttleOFX
1
|
00001 #ifndef _SEQUENCE_PARSER_DETAIL_ANALYZE_HPP_ 00002 #define _SEQUENCE_PARSER_DETAIL_ANALYZE_HPP_ 00003 00004 #include "commonDefinitions.hpp" 00005 #include "FileObject.hpp" 00006 #include "Sequence.hpp" 00007 #include "File.hpp" 00008 #include "Folder.hpp" 00009 00010 #include <boost/ptr_container/ptr_vector.hpp> 00011 #include <boost/lexical_cast.hpp> 00012 00013 #include <iostream> 00014 #include <iomanip> 00015 00016 namespace sequenceParser { 00017 00018 namespace detail { 00019 class FileStrings; 00020 class FileNumbers; 00021 } 00022 00023 /** 00024 * Detect if the researchPath is a correct pattern ( a folder, a file or a pattern with an valid parent directory ) 00025 * 00026 * @param[inout] reseachPath path/pattern to be checked, return the valid research directory 00027 * @param[inout] filters to add pattern of detection present in the researchPath 00028 * 00029 * @return return false if the research path is incorrect with a folder, a file or a pattern with an valid parent directory 00030 */ 00031 bool detectDirectoryInResearch( std::string& researchPath, std::vector<std::string>& filters, std::string &filename ); 00032 00033 00034 Sequence privateBuildSequence( 00035 const Sequence& defaultSeq, 00036 const detail::FileStrings& stringParts, 00037 const std::vector<detail::FileNumbers>::const_iterator& numberPartsBegin, 00038 const std::vector<detail::FileNumbers>::const_iterator& numberPartsEnd, 00039 const std::size_t index, 00040 const std::size_t padding, 00041 const bool strictPadding 00042 ); 00043 00044 void privateBuildSequencesAccordingToPadding( 00045 std::vector<Sequence>& result, 00046 const Sequence& defaultSeq, 00047 const detail::FileStrings& stringParts, 00048 const std::vector<detail::FileNumbers>::iterator& numberPartsBegin, 00049 const std::vector<detail::FileNumbers>::iterator numberPartsEnd, 00050 const int index ); 00051 00052 00053 /** 00054 * @brief Create a vector of sequences from a vector of FileNumbers associated to a common FileStrings. 00055 * 00056 * @param[in] stringParts the sequence identifier 00057 * @param[inout] numberParts the vector of sequence of number inside each filename 00058 * @param[in] desc detection flags 00059 * 00060 * @warning We modify @p numberParts in place, because we don't use it after 00061 * so there is no reason to create a copy. 00062 * @return a sequence object with all informations 00063 */ 00064 std::vector<Sequence> buildSequences( const boost::filesystem::path& directory, const detail::FileStrings& stringParts, std::vector<detail::FileNumbers>& numberParts, const EMaskOptions& desc ); 00065 00066 /** 00067 * @brief Extract number and string parts from a filename. 00068 * 00069 * Example: 00070 * filename = "aa1b22cccc3" 00071 * Will return: 00072 * stringParts = ["aa", "b", "cccc"] 00073 * numberParts = [1, 22, 3] 00074 * 00075 * @param[in] str the string to process (filename) 00076 * @param[out] stringParts vector of strings 00077 * @param[out] numberParts vector of integers 00078 * 00079 * @return number of decteted numbers 00080 */ 00081 std::size_t decomposeFilename( const std::string& filename, detail::FileStrings& stringParts, detail::FileNumbers& numberParts, const EMaskOptions& options ); 00082 00083 } 00084 00085 #endif