| 197 | } |
| 198 | |
| 199 | void GpsTrackStorage::Clear() |
| 200 | { |
| 201 | ASSERT(m_stream.is_open(), ()); |
| 202 | |
| 203 | m_itemCount = 0; |
| 204 | |
| 205 | m_stream.close(); |
| 206 | |
| 207 | m_stream.open(m_filePath, ios::in | ios::out | ios::binary | ios::trunc); |
| 208 | |
| 209 | if (!m_stream) |
| 210 | MYTHROW(WriteException, ("File:", m_filePath)); |
| 211 | |
| 212 | if (!WriteVersion(m_stream, kCurrentVersion)) |
| 213 | MYTHROW(WriteException, ("File:", m_filePath)); |
| 214 | |
| 215 | // Write position is set to the first item in the file |
| 216 | ASSERT_EQUAL(m_stream.tellp(), static_cast<typename fstream::pos_type>(GetItemOffset(0)), ()); |
| 217 | } |
| 218 | |
| 219 | void GpsTrackStorage::ForEach(std::function<bool(TItem const & item)> const & fn) |
| 220 | { |
nothing calls this directly
no test coverage detected