ItemProperties::ItemProperties(const IRI& iri) : _p(None) { string attr(iri.Fragment()); if ( attr.empty() ) attr = iri.LastPathComponent(); this->operator=(attr); }
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; }
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); }