Example #1
0
MetadataSet Metadata::getReferencesByMetadata(const std::string& sMetadataName) const
{
    MetadataSet mdSet;

    if (sMetadataName.empty())
    {
        VMF_EXCEPTION(ValidateException, "MetadataName is empty!");
    }
    else
    {
        std::for_each(m_vReferences.begin(), m_vReferences.end(), [&](const Reference& ref)
        {
            auto spMetadata = ref.getReferenceMetadata().lock();
            if (spMetadata != nullptr)
            {
                if (spMetadata->getName() == sMetadataName)
                {
                    mdSet.emplace_back(spMetadata);
                }
            }
        });
    }

    return mdSet;
}
Example #2
0
MetadataSet Metadata::getReferencesByName(const std::string& sRefName) const
{
    MetadataSet mdSet;

    std::for_each(m_vReferences.begin(), m_vReferences.end(), [&](const Reference& ref)
    {
        auto spDesc = ref.getReferenceDescription();
        auto spMetadata = ref.getReferenceMetadata().lock();
        if ((spMetadata != nullptr) || (spDesc != nullptr))
        {
            if (spDesc->name == sRefName)
                mdSet.emplace_back(spMetadata);
        }
    });

    return mdSet;
}