TuttleOFX  1
sequenceParser Namespace Reference

Namespaces

namespace  detail

Data Structures

struct  SeqIdHash
class  File
class  FileObject
 A container for files, directories and sequences. More...
class  Folder
class  Sequence
 A sequence of numbered files. More...

Typedefs

typedef std::ssize_t Time

Enumerations

enum  EMaskType {
  eMaskTypeUndefined = 0, eMaskTypeDirectory = 1, eMaskTypeFile = eMaskTypeDirectory * 2, eMaskTypeSequence = eMaskTypeFile * 2,
  eMaskTypeDefault = eMaskTypeSequence
}
enum  EMaskOptions {
  eMaskOptionsNone = 0, eMaskOptionsProperties = 1, eMaskOptionsPath = eMaskOptionsProperties * 2, eMaskOptionsAbsolutePath = eMaskOptionsPath * 2,
  eMaskOptionsRecursive = eMaskOptionsAbsolutePath * 2, eMaskOptionsNegativeIndexes = eMaskOptionsRecursive * 2, eMaskOptionsSequenceBasedOnFilename = eMaskOptionsNegativeIndexes * 2, eMaskOptionsDotFile = eMaskOptionsSequenceBasedOnFilename * 2,
  eMaskOptionsColor = eMaskOptionsDotFile * 2, eMaskOptionsDefault = ( eMaskOptionsPath | eMaskOptionsColor )
}

Functions

EMaskType operator~ (const EMaskType &a)
EMaskType operator&= (EMaskType &a, const EMaskType &b)
EMaskType operator|= (EMaskType &a, const EMaskType &b)
EMaskType operator| (const EMaskType &a, const EMaskType &b)
EMaskOptions operator|= (EMaskOptions &a, const EMaskOptions &b)
EMaskOptions operator| (const EMaskOptions &a, const EMaskOptions &b)
EMaskOptions remove (EMaskOptions &a, const EMaskOptions &b)
template<typename T >
greatestCommonDivisor (T a, T b)
bool detectDirectoryInResearch (std::string &researchPath, std::vector< std::string > &filters, std::string &filename)
Sequence privateBuildSequence (const Sequence &defaultSeq, const FileStrings &stringParts, const std::vector< FileNumbers >::const_iterator &numberPartsBegin, const std::vector< FileNumbers >::const_iterator &numberPartsEnd, const std::size_t index, const std::size_t padding, const bool strictPadding)
void privateBuildSequencesAccordingToPadding (std::vector< Sequence > &result, const Sequence &defaultSeq, const FileStrings &stringParts, const std::vector< FileNumbers >::iterator &numberPartsBegin, const std::vector< FileNumbers >::iterator numberPartsEnd, const int index)
bool getVaryingNumber (std::ssize_t &index, const FileNumbers &a, const FileNumbers &b)
std::vector< SequencebuildSequences (const boost::filesystem::path &directory, const FileStrings &stringParts, std::vector< FileNumbers > &numberParts, const EMaskOptions &desc)
std::size_t decomposeFilename (const std::string &filename, FileStrings &stringParts, FileNumbers &numberParts, const EMaskOptions &options)
Sequence privateBuildSequence (const Sequence &defaultSeq, const detail::FileStrings &stringParts, const std::vector< detail::FileNumbers >::const_iterator &numberPartsBegin, const std::vector< detail::FileNumbers >::const_iterator &numberPartsEnd, const std::size_t index, const std::size_t padding, const bool strictPadding)
void privateBuildSequencesAccordingToPadding (std::vector< Sequence > &result, const Sequence &defaultSeq, const detail::FileStrings &stringParts, const std::vector< detail::FileNumbers >::iterator &numberPartsBegin, const std::vector< detail::FileNumbers >::iterator numberPartsEnd, const int index)
std::vector< SequencebuildSequences (const boost::filesystem::path &directory, const detail::FileStrings &stringParts, std::vector< detail::FileNumbers > &numberParts, const EMaskOptions &desc)
 Create a vector of sequences from a vector of FileNumbers associated to a common FileStrings.
std::size_t decomposeFilename (const std::string &filename, detail::FileStrings &stringParts, detail::FileNumbers &numberParts, const EMaskOptions &options)
 Extract number and string parts from a filename.
boost::regex convertFilterToRegex (std::string filter, const EMaskOptions desc)
std::vector< boost::regex > convertFilterToRegex (const std::vector< std::string > &filters, const EMaskOptions desc)
bool filenameIsNotFilter (const std::string &filename, const std::vector< boost::regex > &filters)
bool isNotFilter (const bfs::path &inputPath, const std::vector< boost::regex > &filters, const std::string &filename, const EMaskOptions desc)
boost::ptr_vector< FilefileInDirectory (const std::string &directory, const EMaskOptions desc)
boost::ptr_vector< FilefileInDirectory (const std::string &dir, std::vector< std::string > &filters, const EMaskOptions desc)
boost::ptr_vector< SequencesequenceInDirectory (const std::string &directory, const EMaskOptions desc)
boost::ptr_vector< SequencesequenceInDirectory (const std::string &dir, std::vector< std::string > &filters, const EMaskOptions desc)
boost::ptr_vector< SequencesequenceFromFilenameList (const std::vector< boost::filesystem::path > &filenames, const EMaskOptions desc)
boost::ptr_vector< FileObjectfileAndSequenceInDirectory (const std::string &directory, const EMaskOptions desc)
boost::ptr_vector< FileObjectfileAndSequenceInDirectory (const std::string &dir, std::vector< std::string > &filters, const EMaskOptions desc)
boost::ptr_vector< FolderfolderInDirectory (const std::string &directory, const EMaskOptions desc)
boost::ptr_vector< FolderfolderInDirectory (const std::string &dir, std::vector< std::string > &filters, const EMaskOptions desc)
boost::ptr_vector< FileObjectfileObjectInDirectory (const std::string &directory, const EMaskType mask, const EMaskOptions desc)
boost::ptr_vector< FileObjectfileObjectInDirectory (const std::string &dir, std::vector< std::string > &filters, const EMaskType mask, const EMaskOptions desc)
std::ostream & operator<< (std::ostream &os, const FileObject &fo)
FileObjectnew_clone (const FileObject &a)
static const boost::regex regexPatternStandard ("(.*?)""\\[?""(#+|@+)""\\]?""(.*?)")
 All regex to recognize a pattern.
static const boost::regex regexPatternCStyle ("(.*?)""\\[?""%([0-9]*)d""\\]?""(.*?)")
static const boost::regex regexPatternFrame ("(.*?""[_\\.]?)""\\[?""([0-9]+)""\\]?""([_\\.]?"".*\\.?"".*?)")
static const boost::regex regexPatternFrameNeg ("(.*?""[_\\.]?)""\\[?""([\\-\\+]?[0-9]+)""\\]?""([_\\.]?"".*\\.?"".*?)")

Variables

static const std::string kColorStd = ""
static const std::string kColorFolder = ""
static const std::string kColorFile = ""
static const std::string kColorSequence = ""
static const std::string kColorError = ""

Typedef Documentation

Definition at line 56 of file commonDefinitions.hpp.


Enumeration Type Documentation

Enumerator:
eMaskOptionsNone 
eMaskOptionsProperties 
eMaskOptionsPath 
eMaskOptionsAbsolutePath 
eMaskOptionsRecursive 
eMaskOptionsNegativeIndexes 
eMaskOptionsSequenceBasedOnFilename 
eMaskOptionsDotFile 
eMaskOptionsColor 
eMaskOptionsDefault 

Definition at line 71 of file commonDefinitions.hpp.

List all recognized pattern types.

Enumerator:
eMaskTypeUndefined 
eMaskTypeDirectory 
eMaskTypeFile 
eMaskTypeSequence 
eMaskTypeDefault 

Definition at line 61 of file commonDefinitions.hpp.


Function Documentation

std::vector<Sequence> sequenceParser::buildSequences ( const boost::filesystem::path &  directory,
const detail::FileStrings &  stringParts,
std::vector< detail::FileNumbers > &  numberParts,
const EMaskOptions &  desc 
)

Create a vector of sequences from a vector of FileNumbers associated to a common FileStrings.

Parameters:
[in]stringPartsthe sequence identifier
inout]numberParts the vector of sequence of number inside each filename
[in]descdetection flags
Warning:
We modify numberParts in place, because we don't use it after so there is no reason to create a copy.
Returns:
a sequence object with all informations
std::vector<Sequence> sequenceParser::buildSequences ( const boost::filesystem::path &  directory,
const FileStrings &  stringParts,
std::vector< FileNumbers > &  numberParts,
const EMaskOptions &  desc 
)

Definition at line 268 of file analyze.cpp.

References getVaryingNumber(), and privateBuildSequencesAccordingToPadding().

Referenced by fileAndSequenceInDirectory(), fileObjectInDirectory(), sequenceFromFilenameList(), and sequenceInDirectory().

Here is the call graph for this function:

boost::regex sequenceParser::convertFilterToRegex ( std::string  filter,
const EMaskOptions  desc 
)
std::vector<boost::regex> sequenceParser::convertFilterToRegex ( const std::vector< std::string > &  filters,
const EMaskOptions  desc 
)

Definition at line 70 of file detector.cpp.

References convertFilterToRegex().

Here is the call graph for this function:

std::size_t sequenceParser::decomposeFilename ( const std::string &  filename,
detail::FileStrings &  stringParts,
detail::FileNumbers &  numberParts,
const EMaskOptions &  options 
)

Extract number and string parts from a filename.

Example: filename = "aa1b22cccc3" Will return: stringParts = ["aa", "b", "cccc"] numberParts = [1, 22, 3]

Parameters:
[in]strthe string to process (filename)
[out]stringPartsvector of strings
[out]numberPartsvector of integers
Returns:
number of decteted numbers
std::size_t sequenceParser::decomposeFilename ( const std::string &  filename,
FileStrings &  stringParts,
FileNumbers &  numberParts,
const EMaskOptions &  options 
)

Definition at line 375 of file analyze.cpp.

References eMaskOptionsNegativeIndexes, and tuttle::max().

Referenced by fileAndSequenceInDirectory(), fileInDirectory(), fileObjectInDirectory(), sequenceFromFilenameList(), and sequenceInDirectory().

Here is the call graph for this function:

bool sequenceParser::detectDirectoryInResearch ( std::string &  researchPath,
std::vector< std::string > &  filters,
std::string &  filename 
)

Detect if the researchPath is a correct pattern ( a folder, a file or a pattern with an valid parent directory )

Parameters:
inout]reseachPath path/pattern to be checked, return the valid research directory
inout]filters to add pattern of detection present in the researchPath
Returns:
return false if the research path is incorrect with a folder, a file or a pattern with an valid parent directory

Definition at line 20 of file analyze.cpp.

Referenced by fileAndSequenceInDirectory(), fileInDirectory(), fileObjectInDirectory(), and sequenceInDirectory().

boost::ptr_vector< FileObject > sequenceParser::fileAndSequenceInDirectory ( const std::string &  directory,
const EMaskOptions  desc 
)

Definition at line 369 of file detector.cpp.

boost::ptr_vector< FileObject > sequenceParser::fileAndSequenceInDirectory ( const std::string &  dir,
std::vector< std::string > &  filters,
const EMaskOptions  desc 
)

Definition at line 375 of file detector.cpp.

References buildSequences(), convertFilterToRegex(), decomposeFilename(), detectDirectoryInResearch(), filenameIsNotFilter(), and isNotFilter().

Here is the call graph for this function:

boost::ptr_vector< File > sequenceParser::fileInDirectory ( const std::string &  directory,
const EMaskOptions  desc 
)

Definition at line 131 of file detector.cpp.

Referenced by testFindObjectInDiretory().

boost::ptr_vector< File > sequenceParser::fileInDirectory ( const std::string &  dir,
std::vector< std::string > &  filters,
const EMaskOptions  desc 
)

Definition at line 137 of file detector.cpp.

References convertFilterToRegex(), decomposeFilename(), detectDirectoryInResearch(), filenameIsNotFilter(), and isNotFilter().

Here is the call graph for this function:

bool sequenceParser::filenameIsNotFilter ( const std::string &  filename,
const std::vector< boost::regex > &  filters 
)

Detect if the filename is filtered by one of the filter

Parameters:
[in]filenamefilename need to be check if it filtered
[in]filtersvector of filters
[in]descenable research options (Cf. EMaskOptions in commonDefinitions.hpp )
Returns:
return true if the filename is filtered by filter(s)

Definition at line 89 of file detector.cpp.

Referenced by fileAndSequenceInDirectory(), fileInDirectory(), isNotFilter(), sequenceFromFilenameList(), and sequenceInDirectory().

boost::ptr_vector< FileObject > sequenceParser::fileObjectInDirectory ( const std::string &  directory,
const EMaskType  mask,
const EMaskOptions  desc 
)

Definition at line 519 of file detector.cpp.

Referenced by main(), and testFindObjectInDiretory().

boost::ptr_vector< FileObject > sequenceParser::fileObjectInDirectory ( const std::string &  dir,
std::vector< std::string > &  filters,
const EMaskType  mask,
const EMaskOptions  desc 
)
boost::ptr_vector< Folder > sequenceParser::folderInDirectory ( const std::string &  directory,
const EMaskOptions  desc 
)

Definition at line 473 of file detector.cpp.

Referenced by testFindObjectInDiretory().

boost::ptr_vector< Folder > sequenceParser::folderInDirectory ( const std::string &  dir,
std::vector< std::string > &  filters,
const EMaskOptions  desc 
)

Definition at line 479 of file detector.cpp.

References convertFilterToRegex(), and isNotFilter().

Here is the call graph for this function:

bool sequenceParser::getVaryingNumber ( std::ssize_t index,
const FileNumbers &  a,
const FileNumbers &  b 
)

Definition at line 246 of file analyze.cpp.

Referenced by buildSequences().

template<typename T >
T sequenceParser::greatestCommonDivisor ( a,
b 
) [inline]

Definition at line 124 of file commonDefinitions.hpp.

Referenced by sequenceParser::Sequence::extractStep().

bool sequenceParser::isNotFilter ( const bfs::path &  inputPath,
const std::vector< boost::regex > &  filters,
const std::string &  filename,
const EMaskOptions  desc 
)

Definition at line 104 of file detector.cpp.

References eMaskOptionsDotFile, and filenameIsNotFilter().

Referenced by fileAndSequenceInDirectory(), fileInDirectory(), fileObjectInDirectory(), folderInDirectory(), and sequenceInDirectory().

Here is the call graph for this function:

FileObject* sequenceParser::new_clone ( const FileObject &  a) [inline]

Definition at line 178 of file FileObject.hpp.

References sequenceParser::FileObject::clone().

Referenced by addListOfSequencesInListOfProcess(), and main().

Here is the call graph for this function:

EMaskType sequenceParser::operator&= ( EMaskType &  a,
const EMaskType &  b 
) [inline]

Definition at line 91 of file commonDefinitions.hpp.

std::ostream& sequenceParser::operator<< ( std::ostream &  os,
const FileObject &  fo 
)

Definition at line 9 of file FileObject.cpp.

References sequenceParser::FileObject::getCout().

Here is the call graph for this function:

EMaskType sequenceParser::operator| ( const EMaskType &  a,
const EMaskType &  b 
) [inline]

Definition at line 101 of file commonDefinitions.hpp.

EMaskOptions sequenceParser::operator| ( const EMaskOptions &  a,
const EMaskOptions &  b 
) [inline]

Definition at line 112 of file commonDefinitions.hpp.

EMaskType sequenceParser::operator|= ( EMaskType &  a,
const EMaskType &  b 
) [inline]

Definition at line 96 of file commonDefinitions.hpp.

EMaskOptions sequenceParser::operator|= ( EMaskOptions &  a,
const EMaskOptions &  b 
) [inline]

Definition at line 106 of file commonDefinitions.hpp.

EMaskType sequenceParser::operator~ ( const EMaskType &  a) [inline]

Definition at line 86 of file commonDefinitions.hpp.

Sequence sequenceParser::privateBuildSequence ( const Sequence &  defaultSeq,
const detail::FileStrings &  stringParts,
const std::vector< detail::FileNumbers >::const_iterator &  numberPartsBegin,
const std::vector< detail::FileNumbers >::const_iterator &  numberPartsEnd,
const std::size_t  index,
const std::size_t  padding,
const bool  strictPadding 
)
Sequence sequenceParser::privateBuildSequence ( const Sequence &  defaultSeq,
const FileStrings &  stringParts,
const std::vector< FileNumbers >::const_iterator &  numberPartsBegin,
const std::vector< FileNumbers >::const_iterator &  numberPartsEnd,
const std::size_t  index,
const std::size_t  padding,
const bool  strictPadding 
)
void sequenceParser::privateBuildSequencesAccordingToPadding ( std::vector< Sequence > &  result,
const Sequence &  defaultSeq,
const detail::FileStrings &  stringParts,
const std::vector< detail::FileNumbers >::iterator &  numberPartsBegin,
const std::vector< detail::FileNumbers >::iterator  numberPartsEnd,
const int  index 
)
void sequenceParser::privateBuildSequencesAccordingToPadding ( std::vector< Sequence > &  result,
const Sequence &  defaultSeq,
const FileStrings &  stringParts,
const std::vector< FileNumbers >::iterator &  numberPartsBegin,
const std::vector< FileNumbers >::iterator  numberPartsEnd,
const int  index 
)
Parameters:
result
numberPartsBegin
numberPartsEnd
index

Definition at line 113 of file analyze.cpp.

References privateBuildSequence().

Referenced by buildSequences().

Here is the call graph for this function:

static const boost::regex sequenceParser::regexPatternCStyle ( "(.*?)""\\*  [?""%([0-9]) [static]
static const boost::regex sequenceParser::regexPatternFrame ( "(.*?""[_\\.]?)""\\+  [?""([0-9]) [static]
static const boost::regex sequenceParser::regexPatternFrameNeg ( "(.*?""[_\\.]?)""\\?+  [?""([\\-\\+][0-9]) [static]
static const boost::regex sequenceParser::regexPatternStandard ( "(.*?)""\\?""(.*?)"  [?""(#+|@+)""\\]) [static]
EMaskOptions sequenceParser::remove ( EMaskOptions &  a,
const EMaskOptions &  b 
) [inline]
boost::ptr_vector< Sequence > sequenceParser::sequenceFromFilenameList ( const std::vector< boost::filesystem::path > &  filenames,
const EMaskOptions  desc 
)

<

Todo:
filter by directories, etc.

Definition at line 298 of file detector.cpp.

References buildSequences(), convertFilterToRegex(), decomposeFilename(), eMaskOptionsDotFile, and filenameIsNotFilter().

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:

boost::ptr_vector< Sequence > sequenceParser::sequenceInDirectory ( const std::string &  directory,
const EMaskOptions  desc 
)

Definition at line 217 of file detector.cpp.

Referenced by testFindObjectInDiretory(), and testFirstSequenceLimits().

boost::ptr_vector< Sequence > sequenceParser::sequenceInDirectory ( const std::string &  dir,
std::vector< std::string > &  filters,
const EMaskOptions  desc 
)

Definition at line 223 of file detector.cpp.

References buildSequences(), convertFilterToRegex(), decomposeFilename(), detectDirectoryInResearch(), filenameIsNotFilter(), and isNotFilter().

Here is the call graph for this function:


Variable Documentation

const std::string sequenceParser::kColorError = "" [static]
const std::string sequenceParser::kColorFile = "" [static]
const std::string sequenceParser::kColorFolder = "" [static]
const std::string sequenceParser::kColorSequence = "" [static]

Definition at line 51 of file commonDefinitions.hpp.

Referenced by sequenceParser::FileObject::setColorActive().

const std::string sequenceParser::kColorStd = "" [static]