//-------------------------------------------------------------------------------------------------
const Class& ClassManager::getByName(const std::string& name) const
{
    const NameIndex& names = m_classes.get<Name>();

    NameIndex::const_iterator it = names.find(name);
    if (it == names.end())
        CAMP_ERROR(ClassNotFound(name));

    return *it->classPtr;
}
//-------------------------------------------------------------------------------------------------
const Class& ClassManager::getById(const std::string& id) const
{
    const IdIndex& ids = m_classes.get<Id>();

    IdIndex::const_iterator it = ids.find(id);
    if (it == ids.end())
        CAMP_ERROR(ClassNotFound(id));

    return *it->classPtr;
}
Exemple #3
0
//-------------------------------------------------------------------------------------------------
const Class& ClassManager::getById(StringId id) const
{
    SortedClassVector::const_iterator iterator = std::lower_bound(m_classes.cbegin(), m_classes.cend(), id, OrderByClassId());
    if (iterator != m_classes.end() && iterator->id == id)
    {
        // Found
        return *iterator->classPtr;
    }
    else
    {
        // Not found
        CAMP_ERROR(ClassNotFound(id));
    }
}