PropertyPtr PropertyHolder::PropertyMatching(const string& reference, const string& prefix, bool lookupParents) const
{
    IRI iri = MakePropertyIRI(reference, prefix);
    if ( iri.IsEmpty() )
        return false;
    return PropertyMatching(iri, lookupParents);
}
Example #2
0
PageProgression Package::PageProgressionDirection() const
{
    PropertyPtr prop = PropertyMatching("page-progression-direction");
    if ( prop )
    {
        if ( prop->Value() == "ltr" )
            return PageProgression::LeftToRight;
        else if ( prop->Value() == "rtl" )
            return PageProgression::RightToLeft;
    }
    return PageProgression::Default;
}
PropertyPtr PropertyHolder::PropertyMatching(const IRI& iri, bool lookupParents) const
{
    for ( auto &i : _properties )
    {
        if ( i->PropertyIdentifier() == iri )
            return i;
    }

    if (lookupParents)
    {
        auto parent = _parent.lock();
        if ( parent )
            return parent->PropertyMatching(iri, lookupParents);
    }

    return nullptr;
}
PropertyPtr PropertyHolder::PropertyMatching(const string& reference, const string& prefix) const
{
	return PropertyMatching(reference, prefix, true);
}
PropertyPtr PropertyHolder::PropertyMatching(const IRI& iri) const
{
	return PropertyMatching(iri, true);
}
PropertyPtr PropertyHolder::PropertyMatching(DCType type) const
{
	return PropertyMatching(type, true);
}
PropertyPtr PropertyHolder::PropertyMatching(DCType type, bool lookupParents) const
{
    IRI iri = IRIForDCType(type);
    return PropertyMatching(iri, lookupParents);
}