libsaria: Give Lists a size()

Return the "count" variable and hope we don't have more than
MAX_UNSIGNED_INT objects in the list...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-06-16 13:37:38 -04:00
parent bf0e340a53
commit 311e404af9
3 changed files with 8 additions and 1 deletions

View File

@ -35,6 +35,7 @@ namespace libsaria
ListItem<T> *push_back(T);
void erase(ListItem<T> *);
unsigned int size();
};
};

View File

@ -32,7 +32,7 @@ static void do_save_path(ofstream &stream, void *data)
stream << 2 << "\n"; /* Save file version: 2 */
stream << path->path << "\n";
stream << path->id << " " << path->visible << " ";
stream << path->next_track << " " << path->tracks.size() << "\n";
stream << path->next_track << " " << path->_tracks.size() << "\n";
for (it = path->tracks.begin(); it != path->tracks.end(); it++)
(*it).save(stream);

View File

@ -63,6 +63,12 @@ namespace libsaria
delete node;
}
template <class T>
unsigned int List<T>::size()
{
return count;
}
}
#endif /* LIBSARIA_LIST_CPP */