/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2008-2010, Tomasz Sowa * All rights reserved. * */ #include "groups.h" Groups::Groups() { Clear(); } void Groups::Clear() { table.Clear(); } void Groups::ReadGroups(Db * db) { Clear(); db->GetGroups(table); } Group * Groups::GetGroup(long group_id) { Table::Iterator i = table.FindId(group_id); if( i == table.End() ) return 0; return &(**i); } Group * Groups::GetGroup(const std::wstring & name) { Table::Iterator i = table.FindName(name); if( i == table.End() ) return 0; return &(**i); } long Groups::GetGroupId(const std::wstring & name) { Group * pgroup = GetGroup(name); if( !pgroup ) return -1; return pgroup->id; } Groups::Iterator Groups::Begin() { return table.Begin(); } Groups::Iterator Groups::End() { return table.End(); } Groups::SizeType Groups::Size() { return table.Size(); } Group & Groups::operator[](Groups::SizeType pos) { return table[pos]; }