bool PropertyHolder::ContainsProperty(const string& reference, const string& prefix, bool lookupParents) const
{
    IRI iri = MakePropertyIRI(reference, prefix);
    if ( iri.IsEmpty() )
        return false;
    return ContainsProperty(iri, lookupParents);
}
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);
}
void PropertyHolder::RemoveProperty(const string& reference, const string& prefix)
{
    IRI iri = MakePropertyIRI(reference, prefix);
    if ( iri.IsEmpty() )
        return;
    RemoveProperty(iri);
}
예제 #4
0
ItemProperties::ItemProperties(const IRI& iri) : _p(None)
{
    string attr(iri.Fragment());
    if ( attr.empty() )
        attr = iri.LastPathComponent();
    
    this->operator=(attr);
}
예제 #5
0
EPUB3_EXPORT
DCType DCTypeFromIRI(const IRI& iri)
{
    if ( iri.IsEmpty() )
        return DCType::Invalid;
    auto found = NameToIDMap.find(iri.Fragment());
    if ( found == NameToIDMap.end() )
        return DCType::Custom;
    return found->second;
}
예제 #6
0
Auto<ByteStream> Library::ReadStreamForEPubURL(const IRI &url, CFI *pRemainingCFI)
{
    CFI cfi = url.ContentFragmentIdentifier();
    if ( cfi.Empty() )
    {
        // it references a content document directly
        const Package* pkg = PackageForEPubURL(url);
        if ( pkg != nullptr )
            return pkg->ReadStreamForItemAtPath(url.Path());
    }
    else
    {
        const ManifestItem* item = ManifestItemForCFI(url, pRemainingCFI);
        if ( item != nullptr )
            return item->Reader();
    }
    
    return nullptr;
}
void PropertyHolder::BuildPropertyList(PropertyList& output, const IRI& iri) const
{
    if ( iri.IsEmpty() )
        return;
    
    for ( auto& i : _properties )
    {
        if ( i->PropertyIdentifier() == iri || i->HasExtensionWithIdentifier(iri) )
            output.push_back(i);
    }
}
예제 #8
0
void Property::SetPropertyIdentifier(const IRI& iri)
{
    // HACKINESS ALERT !!
    // *Some* of the properties in the rendition namespace are boolean values whose names contain hyphens.
    // *Some* others in that namespace are simply-named with a value; the name and the value are separated by a hyphen.
    // Le sigh...
    _identifier = iri;
    _type = DCTypeFromIRI(iri);

    auto iriString = iri.URIString();
    auto found = RenditionSplitPropertyLookup.find(iriString);
    if ( found != RenditionSplitPropertyLookup.end() )
    {
        _identifier.SetFragment(found->second.first);
        SetValue(found->second.second);
    }
}
예제 #9
0
void Package::FireLoadEvent(const IRI &url) const
{
    if ( _loadEventHandler == nullptr )
        throw std::runtime_error(_Str("No load event handler installed to load '", url.URIString(), "'"));
    
    if ( url.Path().find(_pathBase) == 0 )
    {
        _loadEventHandler(url);
        return;
    }
    
    IRI fixed(IRI::gEPUBScheme, UniqueID(), _pathBase, url.Query(), url.Fragment());
    fixed.AddPathComponent(url.Path());
    IRI::IRICredentials creds(url.Credentials());
    fixed.SetCredentials(creds.first, creds.second);
    
    _loadEventHandler(fixed);
}
예제 #10
0
IRI Library::EPubCFIURLForManifestItem(const ManifestItem* item) const
{
    IRI packageURL = EPubURLForPublication(item->Package());
    packageURL.SetContentFragmentIdentifier(item->Package()->CFIForManifestItem(item));
    return packageURL;
}