- std::list<std::string> numbers;
-
- std::string current;
- for (size_t i = 0; i < p.string().size(); ++i) {
- if (isdigit (p.string()[i])) {
- current += p.string()[i];
- } else {
- if (!current.empty ()) {
- numbers.push_back (current);
- current.clear ();
- }
- }
- }
-
- if (!current.empty ()) {
- numbers.push_back (current);
- }
-
- std::list<int> numbers_as_int;
- BOOST_FOREACH (std::string i, numbers) {
- numbers_as_int.push_back (raw_convert<int> (i));
+optional<int>
+ImageFilenameSorter::extract_numbers (boost::filesystem::path p)
+{
+ string numbers;
+ string const ps = p.leaf().string();
+ for (size_t i = 0; i < ps.size(); ++i) {
+ if (isdigit (ps[i])) {
+ numbers += ps[i];