MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / load_tasks

Method load_tasks

src/TF2.cpp:137–164  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

135
136////////////////////////////////////////////////////////////////////////////////
137void TF2::load_tasks() {
138 Timer timer;
139
140 if (!_loaded_lines) {
141 load_lines();
142 }
143
144 // Reduce unnecessary allocations/copies.
145 // Calling it on _tasks is the right thing to do even when from_gc is set.
146 _tasks.reserve(_lines.size());
147
148 int line_number = 0; // Used for error message in catch block.
149 try {
150 for (auto& line : _lines) {
151 ++line_number;
152 auto task = load_task(line);
153 _tasks.push_back(task);
154 }
155
156 _loaded_tasks = true;
157 }
158
159 catch (const std::string& e) {
160 throw e + format(" in {1} at line {2}", _file._data, line_number);
161 }
162
163 Context::getContext().time_load_us += timer.total_us();
164}
165
166////////////////////////////////////////////////////////////////////////////////
167void TF2::load_lines() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected