diff --git a/src/Config.cpp b/src/Config.cpp index bc364651a..74ccd90bb 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -657,23 +657,25 @@ void Config::set (const std::string& key, const std::string& value) //////////////////////////////////////////////////////////////////////////////// // Provide a vector of all configuration keys. -void Config::all (std::vector& items) +void Config::all (std::vector& items) const { - foreach (i, *this) - items.push_back (i->first); + std::map ::const_iterator it; + for (it = this->begin (); it != this->end (); ++it) + items.push_back (it->first); } //////////////////////////////////////////////////////////////////////////////// std::string Config::checkForDeprecatedColor () { std::vector deprecated; - foreach (i, *this) + std::map ::const_iterator it; + for (it = this->begin (); it != this->end (); ++it) { - if (i->first.find ("color.") != std::string::npos) + if (it->first.find ("color.") != std::string::npos) { - std::string value = get (i->first); + std::string value = get (it->first); if (value.find ("_") != std::string::npos) - deprecated.push_back (i->first); + deprecated.push_back (it->first); } } @@ -683,8 +685,9 @@ std::string Config::checkForDeprecatedColor () out << "Your .taskrc file contains color settings that use deprecated " << "underscores. Please check:\n"; - foreach (i, deprecated) - out << " " << *i << "=" << get (*i) << "\n"; + std::vector ::iterator it2; + for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2) + out << " " << *it2 << "=" << get (*it2) << "\n"; out << "\n"; } @@ -696,15 +699,16 @@ std::string Config::checkForDeprecatedColor () std::string Config::checkForDeprecatedColumns () { std::vector deprecated; - foreach (i, *this) + std::map ::const_iterator it; + for (it = this->begin (); it != this->end (); ++it) { - if (i->first.find ("report") == 0) + if (it->first.find ("report") == 0) { - std::string value = get (i->first); + std::string value = get (it->first); if (value.find ("entry_time") != std::string::npos || value.find ("start_time") != std::string::npos || value.find ("end_time") != std::string::npos) - deprecated.push_back (i->first); + deprecated.push_back (it->first); } } @@ -716,8 +720,9 @@ std::string Config::checkForDeprecatedColumns () out << "Your .taskrc file contains reports with deprecated columns. " << "Please check for entry_time, start_time or end_time in:\n"; - foreach (i, deprecated) - out << " " << *i << "\n"; + std::vector ::iterator it2; + for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2) + out << " " << *it2 << "=" << get (*it2) << "\n"; out << "\n"; } diff --git a/src/Config.h b/src/Config.h index 9998ab45e..14847bab3 100644 --- a/src/Config.h +++ b/src/Config.h @@ -57,7 +57,7 @@ public: void set (const std::string&, const int); void set (const std::string&, const double); void set (const std::string&, const std::string&); - void all (std::vector &); + void all (std::vector &) const; std::string checkForDeprecatedColor (); std::string checkForDeprecatedColumns (); diff --git a/src/Record.cpp b/src/Record.cpp index 56662ddc7..2c9454863 100644 --- a/src/Record.cpp +++ b/src/Record.cpp @@ -131,8 +131,9 @@ bool Record::has (const std::string& name) const std::vector Record::all () { std::vector all; - foreach (a, (*this)) - all.push_back (a->second); + std::map ::iterator i; + for (i = this->begin (); i != this->end (); ++i) + all.push_back (i->second); return all; } diff --git a/src/Sequence.cpp b/src/Sequence.cpp index ad943fabe..80af1a850 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -135,13 +135,17 @@ void Sequence::combine (const Sequence& other) // Create a map using the sequence elements as keys. This will create a // unique list, with no duplicates. std::map both; - foreach (i, *this) both[*i] = 0; - foreach (i, other) both[*i] = 0; + std::vector ::iterator i1; + for (i1 = this->begin (); i1 != this->end (); ++i1) both[*i1] = 0; + + std::vector ::const_iterator i2; + for (i2 = other.begin (); i2 != other.end (); ++i2) both[*i2] = 0; // Now make a sequence out of the keys of the map. this->clear (); - foreach (i, both) - this->push_back (i->first); + std::map ::iterator i3; + for (i3 = both.begin (); i3 != both.end (); ++i3) + this->push_back (i3->first); std::sort (this->begin (), this->end ()); } diff --git a/src/edit.cpp b/src/edit.cpp index 63e431e58..04760c1ff 100644 --- a/src/edit.cpp +++ b/src/edit.cpp @@ -161,7 +161,8 @@ static std::string formatTask (Task task) std::vector annotations; task.getAnnotations (annotations); - foreach (anno, annotations) + std::vector ::iterator anno; + for (anno = annotations.begin (); anno != annotations.end (); ++anno) { Date dt (::atoi (anno->name ().substr (11).c_str ())); before << " Annotation: " << dt.toString (context.config.get ("dateformat.annotation")) @@ -533,7 +534,8 @@ static void parseTask (Task& task, const std::string& after) split (dependencies, value, ","); task.remove ("depends"); - foreach (dep, dependencies) + std::vector ::iterator dep; + for (dep = dependencies.begin (); dep != dependencies.end (); ++dep) { int id = atoi (dep->c_str ()); if (id) @@ -644,7 +646,8 @@ int handleEdit (std::string& outs) std::vector all = tasks; context.filter.applySequence (tasks, context.sequence); - foreach (task, tasks) + std::vector ::iterator task; + for (task = tasks.begin (); task != tasks.end (); ++task) { editFile (*task); context.tdb.update (*task); @@ -652,7 +655,8 @@ int handleEdit (std::string& outs) TODO Figure out what this is. I can't remember, but don't want to remove it until I do. - foreach (other, all) + std::vector ::iterator other; + for (other = all.begin (); other != all.end (); ++other) { if (other->id != task.id) // Don't edit the same task again. { diff --git a/src/rules.cpp b/src/rules.cpp index 4dcf71557..55f8e670b 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -49,14 +49,15 @@ void initializeColorRules () std::vector rules; std::vector variables; context.config.all (variables); - foreach (it, variables) + std::vector ::iterator v; + for (v = variables.begin (); v != variables.end (); ++v) { - if (it->substr (0, 6) == "color.") + if (v->substr (0, 6) == "color.") { - Color c (context.config.get (*it)); - gsColor[*it] = c; + Color c (context.config.get (*v)); + gsColor[*v] = c; - rules.push_back (*it); + rules.push_back (*v); } } @@ -66,13 +67,15 @@ void initializeColorRules () std::vector precedence; split (precedence, context.config.get ("rule.precedence.color"), ','); - foreach (it, precedence) + std::vector ::iterator p; + for (p = precedence.begin (); p != precedence.end (); ++p) { // Add the leading "color." string. - std::string rule = "color." + *it; + std::string rule = "color." + *p; autoComplete (rule, rules, results); - foreach (r, results) + std::vector ::iterator r; + for (r = results.begin (); r != results.end (); ++r) gsPrecedence.push_back (*r); } } diff --git a/src/ui/ReportStats.cpp b/src/ui/ReportStats.cpp index c8423e3a6..d0e37d338 100644 --- a/src/ui/ReportStats.cpp +++ b/src/ui/ReportStats.cpp @@ -152,7 +152,8 @@ void ReportStats::gatherStats () std::vector undo; File::read (file, undo); int undoCount = 0; - foreach (tx, undo) + std::vector ::iterator tx; + for (tx = undo.begin (); tx != undo.end (); ++tx) if (tx->substr (0, 3) == "---") ++undoCount; @@ -213,7 +214,8 @@ void ReportStats::gatherStats () it->getTags (tags); if (tags.size ()) ++taggedT; - foreach (t, tags) + std::vector ::iterator t; + for (t = tags.begin (); t != tags.end (); ++t) allTags[*t] = 0; std::string project = it->get ("project");