-
Notifications
You must be signed in to change notification settings - Fork 12
Sequence: add max padding attribute #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cchampet
merged 11 commits into
mikrosimage:develop
from
cchampet:dev_addMaxPaddingToSequence
Jan 15, 2016
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e6eed33
Sequence: renamed _padding to _fixedPadding
36b2d83
Sequence: replaced _strictPadding to _maxPadding
c656a38
filesystem: removed unnecessary calls to extractStep/Padding when bro…
533971c
Sequence: added getPrintfPattern method
54f25f6
Item: updated path value in case of sequence
766ef12
Sequence: added doc to explain _maxPadding attribute
3717b7b
Sequence: rename getStandardPattern to getFilenameWithStandardPattern
c86625c
Sequence: rename getPrintfPattern to getFilenameWithPrintfPattern
af70a9a
Item: use standardPattern instead of printfPattern when set path of a…
b8565cd
pyTest: fixed testBrowse
9c367d6
Up to v1.2.0
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| #include "common.hpp" | ||
| #include "FrameRange.hpp" | ||
|
|
||
| #include <boost/lexical_cast.hpp> | ||
|
|
||
| #include <iomanip> | ||
| #include <set> | ||
|
|
||
|
|
@@ -41,9 +43,9 @@ class Sequence | |
| clear(); | ||
| } | ||
|
|
||
| Sequence( const std::string& prefix, const std::size_t padding, const std::string& suffix, const Time firstTime, const Time lastTime, const Time step = 1, const bool strictPadding = false ) | ||
| Sequence( const std::string& prefix, const std::size_t padding, const size_t maxPadding, const std::string& suffix, const Time firstTime, const Time lastTime, const Time step = 1 ) | ||
| { | ||
| init( prefix, padding, suffix, firstTime, lastTime, step, strictPadding ); | ||
| init( prefix, padding, maxPadding, suffix, firstTime, lastTime, step ); | ||
| } | ||
|
|
||
| Sequence( const std::string& pattern, const std::vector<FrameRange>& frameRanges, const EPattern accept = ePatternDefault ) | ||
|
|
@@ -68,8 +70,8 @@ class Sequence | |
| { | ||
| _prefix = other._prefix; | ||
| _suffix = other._suffix; | ||
| _strictPadding = other._strictPadding; | ||
| _padding = other._padding; | ||
| _maxPadding = other._maxPadding; | ||
| _fixedPadding = other._fixedPadding; | ||
| _ranges = other._ranges; | ||
| return *this; | ||
| } | ||
|
|
@@ -81,7 +83,7 @@ class Sequence | |
| * @brief Construct a sequence from a pattern and given informations. | ||
| * @warning No check on your filesystem. | ||
| */ | ||
| void init( const std::string& prefix, const std::size_t padding, const std::string& suffix, const Time firstTime, const Time lastTime, const Time step = 1, const bool strictPadding = false ); | ||
| void init( const std::string& prefix, const std::size_t padding, const size_t maxPadding, const std::string& suffix, const Time firstTime, const Time lastTime, const Time step = 1 ); | ||
|
|
||
| public: | ||
| std::string getFilenameAt( const Time time ) const; | ||
|
|
@@ -92,7 +94,10 @@ class Sequence | |
| inline char getPatternCharacter() const; | ||
|
|
||
| /// @return a string pattern using standard style | ||
| inline std::string getStandardPattern() const; | ||
| inline std::string getFilenameWithStandardPattern() const; | ||
|
|
||
| /// @return a string pattern using printf style | ||
| inline std::string getFilenameWithPrintfPattern() const; | ||
|
|
||
| /// @return a string pattern using C Style | ||
| std::string getCStylePattern() const; | ||
|
|
@@ -107,9 +112,9 @@ class Sequence | |
|
|
||
| Time getNbFiles() const; | ||
|
|
||
| inline std::size_t getPadding() const; | ||
| inline std::size_t getFixedPadding() const; | ||
|
|
||
| inline bool isStrictPadding() const; | ||
| inline std::size_t getMaxPadding() const; | ||
|
|
||
| inline bool hasMissingFile() const; | ||
|
|
||
|
|
@@ -135,15 +140,16 @@ class Sequence | |
|
|
||
| bool operator<(const Sequence& other ) const | ||
| { | ||
| return getStandardPattern() < other.getStandardPattern(); | ||
| return getFilenameWithStandardPattern() < other.getFilenameWithStandardPattern(); | ||
| } | ||
|
|
||
| bool operator==(const Sequence& other ) const | ||
| { | ||
| return | ||
| ( _prefix == other._prefix ) && | ||
| ( _suffix == other._suffix ) && | ||
| ( _padding == other._padding ) && | ||
| ( _maxPadding == other._maxPadding ) && | ||
| ( _fixedPadding == other._fixedPadding ) && | ||
| ( _ranges == other._ranges ); | ||
| } | ||
|
|
||
|
|
@@ -183,8 +189,8 @@ class Sequence | |
| { | ||
| _prefix.clear(); | ||
| _suffix.clear(); | ||
| _strictPadding = false; | ||
| _padding = 0; | ||
| _maxPadding = 0; | ||
| _fixedPadding = 0; | ||
| _ranges.clear(); | ||
| } | ||
|
|
||
|
|
@@ -193,8 +199,26 @@ class Sequence | |
| public: | ||
| std::string _prefix; ///< filename prefix | ||
| std::string _suffix; ///< filename suffix | ||
| bool _strictPadding; ///< | ||
| std::size_t _padding; ///< padding, no padding if 0, fixed padding otherwise | ||
| /** | ||
| * @brief Number max of common padding used to enumerate the sequence | ||
| * @note For fixed sequences, it is equal to the padding | ||
| * @note Useful for sequence with a variable or an unknown padding | ||
| * unknown padding = when no frame begins with a '0' padding character | ||
| * seq.101.jpg | ||
| * seq.102.jpg | ||
| * seq.102.jpg | ||
| * variable padding = when not all frames have the same padding | ||
| * seq.0101.jpg | ||
| * seq.0100.jpg | ||
| * seq.099.jpg | ||
| */ | ||
| std::size_t _maxPadding; | ||
| /** | ||
| * @brief Fixed padding | ||
| * @note if 0, variable padding | ||
| * @see _maxPadding | ||
| */ | ||
| std::size_t _fixedPadding; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an example for the ambiguous case. |
||
| std::vector<FrameRange> _ranges; | ||
| static const char _fillCar = '0'; ///< Filling character | ||
| }; | ||
|
|
@@ -213,7 +237,7 @@ std::size_t extractStep( const std::vector<Time>& times ); | |
| */ | ||
| std::size_t extractStep( const std::vector<detail::FileNumbers>::const_iterator& timesBegin, const std::vector<detail::FileNumbers>::const_iterator& timesEnd, const std::size_t i ); | ||
|
|
||
| std::size_t getPaddingFromStringNumber( const std::string& timeStr ); | ||
| std::size_t getFixedPaddingFromStringNumber( const std::string& timeStr ); | ||
|
|
||
| /** | ||
| * @brief extract the padding from a vector of frame numbers | ||
|
|
@@ -223,15 +247,6 @@ std::size_t extractPadding( const std::vector<std::string>& timesStr ); | |
|
|
||
| std::size_t extractPadding( const std::vector<detail::FileNumbers>::const_iterator& timesBegin, const std::vector<detail::FileNumbers>::const_iterator& timesEnd, const std::size_t i ); | ||
|
|
||
| /** | ||
| * @brief return if the padding is strict (at least one frame begins with a '0' padding character). | ||
| * @param[in] timesStr vector of frame numbers in string format | ||
| * @param[in] padding previously detected padding | ||
| */ | ||
| bool extractIsStrictPadding( const std::vector<std::string>& timesStr, const std::size_t padding ); | ||
|
|
||
| bool extractIsStrictPadding( const std::vector<detail::FileNumbers>& times, const std::size_t i, const std::size_t padding ); | ||
|
|
||
| #endif | ||
|
|
||
| #include <Sequence.tcc> | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to have min/max padding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it could be great to have the two info.. For an other release...? =D