Exemple #1
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);
    }
}
Exemple #2
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);
}